I notice that RaycastHit is called differently for JS vs C#... In C#, the hit is actually
asked Apr 07 '12 at 09:37 PM
As far as I know, the Out gives you the info about what it hit, like the distance to the hit, the name of the object it hit, the point where it hit, and so on.
It can be very helpful in some cases where you wanna know if a laser hit a friendly target or an enemy, for example.
Most function arguments are passed by value -- that is, you pass a copy of the original value, rather than the variable itself. Changes made to that copy won't be reflected in the original variable unless your code does so explicitly.
Some functions accept arguments that are passed by reference -- instead of a copy, you pass the original variable itself. Changes made in the called function will be reflected in the original variable.
C# and UnityScript both typically pass by value, unless the called function explicitly tells the compiler to pass by reference. C# is unique in that it requires coders to explicitly pass by reference on both sides of the call -- I assume the idea is to make sure that you know you're doing so, as it can sometimes lead to confusion.
Ultimately, both languages are doing the same thing. C# just has a slightly different syntax for doing so.
answered Apr 07 '12 at 11:07 PM