I’m trying to use collider.raycast but it gave me the following error MissingMethodException: Method not found: 'UnityEngine.Collider.Raycast'.
So I checked again the docs and there’s #pragma strict there, which I don’t know what it is, but doc files says it’s there because of a “UnityJS issue”
So I add #pragma strict at the top of everything, but now the whole code doesn’t work anymore. It gives me a whole bunch of new errors like
Assets/Scripts/fishAI.js(13,10): BCE0019: 'transform' is not a member of 'Object'.
It’s like it doesn’t recognize my global variables anymore…
If I delete #pragma strict code goes back to normal, but I still can’t use collider.raycast
Strict means enforced typing. You need to explicitly state what type each variable is. You cannot let the compiler decide, nor can you just make a random name and expect the compiler to instantiate a variable for you.
This is regularly good practice, but not enforced normally in UnityScript.