Hello, I don’t usually ask for help directly and always find the answer to my problem online but this time I’m clearly stuck ! I think my problem is similar to this one which is a year old and has had no answer since.
The difficulty lies in the fact I don’t know if it’s a bug or a misunderstanding of myself.
When I first launch the project, the UI appears as it should.
But after launching the game a first time, all the non-sprite elements have disappeared.
What my scripts do during play mode involves some
gameObject.SetActive(true/false); and from what I understand even if I leave some objects disabled, they should still appear in Editor Mode as they are re-enabled automatically.
I tried enabling/disabling game objects with no success however when I changed one of the disappeared game objects layer from ‘UI’ to ‘Default’ and started/stopped the game, everything reappeared. I’m not able to understand why it behaves this way.
If you have any idea or if you have already encountered this problem, please let me know how I should solve it. If you need more information, just let me know I’ll add it to my question !
EDIT : I’m clearly wondering if this could be a script related issue. Does enabling and disabling UI elements while in Play Mode change the way UI elements appear in Scene Mode ?
EDIT2 : I feel so dumb, after playing a bit with it, trying to add some
Canvas.ForceUpdateCanvases (); everywhere, I found the case in which I had this problem : I have a blinking text and when I start the game while it is ‘off’, it just produces the above bug. However, if I start the game while the blinking text is ‘on’ it just works fine thus explaining the erratic nature of the issue I encountered.
I’ll just take a break and then will look at the blinking code (5 lines long ) to see what was the cause of the issue. Even if I had put some code here, I wouldn’t have thought it was caused by such a meaningless part of all the code I currently have. Sorry for the inconvenience, I’ll keep you up !
EDIT 3: Found the problem and put it as an answer below. Also removed the picture as they aren’t relevant to the issue. Thanks for the help though.