created a button that clicks the window (Delete)
panel. Bottom script.
using system.collections;
Using System.Collections.Genic;
using unityengine;
Public Class Actions: Monobehaviour
{
Public Void Delete ()
{
// int ID = GameObject.Transform.Parent.getcomponent & lt; ID & GT; (). ID;
GameObject Deletewindow = GameObject.find ("Window (Delete)");
Print (Deletewindow);
//Deletewindow.getcomponent<delete> ;().id = id;
//Deletewindow.setActive(True);
}
}
To my surprise, the result is returned empty and because of this pops error
NULLReferenceException: Object Reference Not Set to An Instance of An Object
Screenshot here and below.
Such errors began to meet with me often.
Finally someone tell me – where is my mistake?
Answer 1, Authority 100%
GameObject.find
Lookages only active objects. And you have this panel, judging by the screen, turned off.
Try search with Resources.findObjectSoftypeall
. It seems like inactive objects will also return.