Object Referance not set to an instance of an object?

public var target3 : GameObject;
function OnGUI () {

    GUI.Box (Rect (10,10,100,90), "Loader Menu");

    if (GUI.Button (Rect (20,40,80,20), "camera1")) {

            target3  = GameObject.Find("target3");
    target3.animation.Stop();
    }

the target 3 is a Gameobject in my scene which is a child of another gameobject, the problem i am having is that whenever i go to access the target3(through script) it removes itself from the inspector(I.E, it says Non (Game Object)

any idea how to fix this?

line 8 must be returning a null value and is overwriting the value set in the inspector when the script is running.

check spelling, case, etc. on that argument against the actual target3 object in your scene (and check there is actually an object called target3 in the scene :p)

Thanks :smile: Worked Great