GameObject can be seen through panel inside a canvas.
Hello, I'm making a 2D game where I instantiate a bunch of missiles. Problem is with my pause panel. When I pause the game, it uses SetActive() to enable a panel. But the missiles can be seen on top of the panel. Other game objects in the game do not do this. The only difference between the missiles and other game objects is that the missiles are instantiated. So far I have tried,
Putting different "Order in Layer" for the Panel canvas and the missiles (But in the same "Sorting Layer")
Putting different "Sorting Layer". This really messed up my scene. Other game objects will show the same problem.
Changing the missiles' (prefab) and their spawn points' z position to 0.
Putting a canvas component in the panel and setting the sorting order and sorting layer.
putting the camera (Orthographic) far away and using different render mode for the canvas. Ideally, I prefer "Screen Space - Camera" since its an android game.
Nothing worked. On top of that while fiddling around with these settings something happened and the buttons on my panel stopped responding. I had to create the entire canvas again.
I am stumped. Any help would be much appreciated. Thanks in advance.
Answer by mmakill71 · Apr 02, 2018 at 01:35 AM
I bypassed the problem by using "Screen Space - Overlay". Which means there's nothing under the canvas to show.
I DID find the problem fascinating and couldn't find a solution other than to avoid it. As I recall, Borderlands 2 has a very similar problem where some characters(i.e. Deathtrap) would be visible through inventory menu. Maybe the problem exists in a much deeper level of the engine coding.
Your answer
Follow this Question
Related Questions
Render canvas inside Sorting Group 0 Answers
Programmatically Ordering Game Objects in 2d / Hierarchy 0 Answers
Button in one panel affects another? 1 Answer
Panel behind panel is visible even though the first panel has Alpha set to 255 0 Answers
Trouble getting my Pause menu "above" my Scene canvas. 1 Answer