I'm building a game in Unity3d using C#. I was looking at some code, however it is in unityscript. I came this code and I'm not sure how to convert it to C#:
for(var hit : Collider in colliders)
well that's fairly easy to write in C# You're using a for-each loop and C# has a specific foreach keyword for this situation. Your code becomes the following :
foreach(var hit in colliders)
The thing you might not get from this is this: why is he not specifying that hit is of type Collider? Well, in C#, when using the keyword var, you're actually declaring that this variable is anonymous and the compiler will use type inference to determine what type of data is actually being passed around.
foreachstatement.