- Home /
Unity UI not showing some Images
Hi guys,
I am making UI for my game and my problem is that I can not manage to make UI Images visible anymore.
Everything worked fine until few hours ago. I have 6 level deep hierarchy on Canvas. I am making UI like this:
I create .png-s from .psd layers from Photoshop. I make GOs in world space, then I make that object son of Main Window, rescale so it fits fine, replace Transform with RectTransform, add UI/Image component, and set proper sprite. Image is not visible nether on Scene nor Game view.
I made half of UI this way and I stuck now.
My hierarchy look Like this:
Canvas
MainWindow
Mask (with ScrollRect)
FatherGO (I group Panels with this)
PanelImage (Scrollable)
GO (father of sprites)
Button (with which I have problem)
...
...
(i have 4 of them, everyone acting same)
PanelImage (Scrollable - Did exactly the same in this hierarchy with no problems)
...
(visible Images)
Z axis val is 0 on all objects in hierarchy.
Canvas render mode is Screen Space - Camera.
I have CanvasRenderer on GO that is making problems.
I tried with both Image and Raw Image with no results.
When I that problematic GO Image is Visible. It seems like Mask is hiding image but i do not know how come because I am not referencing to any RectTransform, I control that in script.
Also when I start Unity is throws me 3 same errors: aabb.IsValid()
I do not have that function, and when I double click on it in console it does not highlight it in MonoBehaviour.
Strange as hell!
I hope someone know what is going on.
Cheers!
UPDATE:
When I resize Mask to be bigger I see the Image. It seems it does inverse mask to that GO.
Also, when I move Image up to hierarchy (to be direct child of GameObject Mask) the Image is visible.
It is a kind of solution but It would be much more easier to use gameObject.SetActive(bool TorF) to one GO that is father of all that I want to show/hide at the moment then to loop trough children, check names and use gameObject.SetActive(bool TorF).
It is very unusual behaviour considering I manage to make Images visible on other GO. same deep in hierarchy.
Hope this will help someone figure out why is this happening.
Thanks.
Referring to this: http://answers.unity3d.com/questions/255190/aabbisvalid-error.html for you error may help you understand what is happening.
Couple of questions:
Your first PanelImage has a GO (father of sprites) child. Is it an empty GO, right?
Your second PanelImage doesn't have a GO (father of sprites) child, correct?
When the game is running inside the editor, and you double click one of the visible images in the hierarchy panel, can you see its RectTranform size inside the Scene view (press 'T')? and can you see the size for the invisible buttons doing this?
$$anonymous$$aybe the problem is related to the scrollable panels being resized depending on their inmediate content, but the first panel has an empty GO as content and is not taking into account the grandchildren Buttons.
@Fariel I somehow manage to get rid of that error, but with no results. Thanks anyway.
@AndresBarrera 1. Yes 2. It have GO (father of sprites). 3. Yes, RectTransform of it is visible. I updated Question just now so take a look if you are willing.
Your answer
Follow this Question
Related Questions
Can't change Image sprite because in rebuild loop? 2 Answers
Fading Out UI On Play 1 Answer
Get size of UI Image at runtime 3 Answers
Problem when scrolling through inventory slots 0 Answers
What's your equivalent of old GUIStyle ? 0 Answers