I’m trying to check if a parent’s script’s gameobject variable equals a gameobject. Void OnMouseDown works fine but the if statement never equals true for some reason. Void OnGUI is check every frame like update and there isn’t anything preventing Void OnGUI itself from running. Any ideas?
void OnMouseDown() {
transform.parent.GetComponent<ParentScript>().curGO = gameObject;
}
void OnGUI(){
if(gameObject == transform.parent.GetComponent<ParentScript>().curGO){
GUI.Window(0, new Rect(Screen.width/2 + 200, Screen.height/2 - 275, 300, 550), WindowFunction, "Window Function");
}
}