|
Typecasting as in from Object to GameObject, int to float etc.
(comments are locked)
|
|
You can use "as" for reference types. There isn't a direct method for value types, but you can use parseFloat or parseInt in the case of floats and ints. To be fair, he said "UnityScript" not Javascript, nor C#, nor Boo. So it wasn't very specific.
Jul 05 '12 at 06:20 PM
ThePunisher
I guess we all call Javascript Unity Script here to be clear that it isn't actually Javascript. Unity internally compiles to a UnityScript dll when you write 'Javascript'
Jul 05 '12 at 06:27 PM
whydoidoit
Yes - and given that it makes everyone think it is real Javascript that is a very big shame (given the massive differences). Hence many people specifically call it Unity Script to try to be clear or to raise the question and make the point. I agree that this is not an ideal situation.
Jul 05 '12 at 06:42 PM
whydoidoit
Yep. I guess the point I was trying to make was that I didn't know UnityScript meant JavaScript. I'll keep that in mind next time.
Jul 05 '12 at 06:44 PM
ThePunisher
I am sorry if i haven't made myself clear to others. The JavaScript Unity uses is in many ways different from normal JavaScript ( the original language ). So i asked about UnityScript, i.e. Unity's JavaScript. @ThePunisher
Jul 06 '12 at 10:39 AM
arkochelsea
(comments are locked)
|
Bizarrely, the question specifically asks for UnityScript and people post C# answers...not helpful....
Jul 05 '12 at 05:37 PM
Eric5h5
(comments are locked)
|
