0
votes

I'm a Computer Science Engineering student. I'm currently working on a Uni project using Unity to build a 2D game. Until this morning everything was fine, but suddenly after some work on a UI Manager Script in my menu scene (Scene 0) when I tried to play the game some gameobjects (apparently random) stopped to be visualized on Scene View and on Game View in the Level scene (Scene 1). I can see all gameobjects fine on camera preview and they all are active in the hierarchy, even all colliders are working.

I tried to look on the web, but I can't find any solution or any similar case... I don't really have any ideas, I'll be really glad if someone can help me. Thanks.

Could be a lot of things. For things not showing up in the scene view, make sure you don't have object that are hidden in the hierarchy (Unity 2019 show up as a eye icon left of an gameObject in the hierarchy). For the game view, if you can see the objects in the preview try and use the frame debugger (Window->Analysis->Frame Debugger) when in play mode,click enable, then select scroll from top to bottom in the list (basically it the order all elements are renderer and you get a preview). That way you can check if something is rendering on top of your missing elements. - leo Quint
Hey, thank you for the answer. It's a problem with the rendering order. Can you please specify (if you know) how to change the rendering order so I can solve the problem? - Gu160
Please, provide more informations or screenshots of the situation. - user13278024
Hi Federico, actually Leo Quint answer showed me that the problem is in the rendering order. But I don't know how to change this order... - Gu160
Unity will render object based on their shader's render queue (you can check that on the material, smaller number = rendered first) then based on the distance from the camera (if something is closer to a camera it gets rendered after things that are further away). For shaders usually you have a few main one like opaque (2000 gets rendered early) or transparent (3000 rendered later). Also remember that for distance from the camera you have too look not at the gameobject's position but its closest vertices (i.e. a cube at (0,0,0) has vertices at positions in all 4 directions) - leo Quint