var crosshair : Texture2D;
private var explosion : GameObject;
function Start () {
Screen.lockCursor = true;
}
function OnGUI () {
GUI.Label (Rect (Screen.width / 2,Screen.height / 2,25,25), crosshair);
}
function Update () {
explosion = GameObject.Find("Explosion");
}
function IgnoreCollision () {
if(explosion == GameObject.Find("Explosion")) {
Physics.IgnoreCollision(explosion.collider, collider);
}
}
No errors, it simply doesn’t work. The issue is that the “Explosion” is being instantiated. It is not there when the game loads. I wrote a script that ignores collision fine with an object that is already in the scene, and this is my attempt at modifying it to work with an instantiated prefab.
Help?