- Home /
Instantiating Image makes whole Canvas disappear in Playmode
Hi, I encountered a strange issue today: I'm using one canvas to setup my whole UI. I have a component, that instantiates a couple of panels during runtime. Right now a panel is just an image. When I instantiate the Image by code, everything in the Canvas becomes invisible.
The Canvas is enabled, all of the Canvas' children are enabled, the instantiated images are enabled. When I disable all the instantiated images, everything else becomes visible again. Using Unity 2019.2.12f1
Here's my hierachy with the Canvas selected:
Here's my hierachy with one of the images selected:
Answer by oTaijjo · Dec 05, 2019 at 02:19 PM
Okay, I found a solution. The images are instantiated at localPosition (1, 1, 1). Somehow a positive Z coordinate makes the whole canvas go bogus. Instantiating them at (0, 0, 0,) fixed the issue. Still weird!
Your answer
Follow this Question
Related Questions
How do I add a "pointer" to my UI menu? 1 Answer
UI - clamp the movement of a panel 0 Answers
Difficulties with world space canvas interaction 1 Answer
2D Collider/Trigger on Canvas 2 Answers
Display loaded UI Image in Container with native size 0 Answers