Hello,
I’ve got a strange problem. I have build some UI Panels with texts that should only appear once the player collides with a certain object. There are different planes for different objects.
Now, I already managed to set it so that it works. The scripts are fine. But for some reason now every time I start the game, all the UI panels that were set inactive in the hierarchy, are automatically set active and they pile on top of each other. Funnily, when I manually disable them once the game starts, everything later works just fine. They pop up and disappear as scripted.
I tried adding a Start function to my GameManager that force disables them at start (even though I shouldn’t have to, since I disabled them in the inspector!), but it also doesn’t work. There is no other start function running that I know of that would force-enable them at start.
I also don’t know what changed, since I had it all working just this morning and didn’t change anything in the scripts since then (just build some additional parts of the world).
I am confused at what can the problem be. Please help.
Hello, without looking at your project it’s really hard to tell what’s wrong, but I also suspect you’re on the wrong forum - are you using UI Toolkit or are you using UGUI?
If you’re making your UI with UXML/USS files, then you’re using UI Toolkit and this is the right place 
If you’re using the Canvas component, then you’re using UGUI and we can move your post to the right place 
In any case, it’ll be really hard to troubleshoot with the info you gave us. I’d check other parts of the code that could be calling to enable all Game Objects, make sure the Game Objects you want disabled are really disabled in the Scene when you’re not in Play Mode (since changes done in Play Mode are not kept); you can also instantiate the UI when you need it, keep them as Prefabs in the project until you do.
Yeah, I’m using canvas, so my post should probably be moved.
And yes, I’m making the changes while not in Play Mode, but my current suspicion is that some asset I’ve downloaded or some update that I have allowed somehow messed with a start function and that this start function (that I cannot find!) is overwriting the UIs at the beginning. I found a temporary solution, that is, I disable them after pressing the Enter button after the game starts [in the update function] - and that’s why I feel something is overwriting the start function, because when I tried to just disable them at start, it didn’t work. And if I press Enter a bit too quickly at the beginning of the game, only some of the UIs disappear - as if the Start function was still running in the background and activating them, so when I press enter I disable only the ones that have already been activated by the start function.
It’s super weird but at least I have found this weird and dirty solution for now.
This thread is now on the UGUI Forum, let’s see if more people have ideas for you 