Twayne
1
Adding #pragma script to a script actually causes an error in another script. Here is the code
for(var gameObj : GameObject in GameObject.FindObjectsOfType(GameObject)){
if(gameObj.name == "Curved Wall") gameObj.SendMessage("Send");
if(gameObj.name == "Straight Wall") gameObj.SendMessage("Send");
}
The error message is - Cannot convert 'UnityEngine.Object' to 'UnityEngine.GameObject'. This code works great without the pragma strict which I needed because I read that I need it for mobile devices which I will port this project to later.
system
2
FindObjectsOfType returns an Object, and you're trying to store it as a GameObject. When using `#pragma strict`, you need to explicitly typecast.
Take a look at the answers here for an explanation, but in short, just typecast "as GameObject":
for(var gameObj : GameObject in GameObject.FindObjectsOfType(GameObject) as GameObject)