Issue Ignoring Collisions

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?

If you put an if statement in that checks if the explosion has been instantiated so it didn’t run the other code until explosion is in the scene would that fix it?

hey i couldnt understand where should i post a new thread.Please help me.