Hi all, So I’ll cut straight to it.
I have this code which was working perfectly fine until I added the current scene to the build settings and changed scene.
case 2:
players = int.Parse(value);
for (int p = 1; p <= players; p++) {
GameObject.Find(p+"P").GetComponent<GUINav>().enabled = true;
}
GameData.newCharacterSelect();
mm.setMenu(3);
break;
Now there is more to this code but all we need to focus on is this part
GameObject.Find(p+“P”).GetComponent().enabled = true;
It seems Unity is having trouble finding my GUINav script when I have (p+“P”) in my find. however (“2P”) or (2+“P”) works completely fine.
Like I said I saved everything before I added to build and changed scene so I really have no idea why it was working before that but not now.
The error I keep getting is “NullReferenceException: Object reference not set to an instance of an object” which seems fitting considering with this method I can find the object, just not the component.
I’m so far into the game now this is pretty much my last real hurdle so it’s irritating the hell out of me.
Can anyone offer any insight?
Kindest Regards
Max