Alex
Alex

Reputation: 13

Unity: UI prefabs go invisible when i Instantiate it

I have a custom UI element in the Mainmenu scene that works fine, but when i make a prefab out of it, all the text and images become invisible, and the rect transform goes blank

The orginal prefab

the instatiated invisible prefab

Upvotes: 1

Views: 1431

Answers (1)

MrPaparoz
MrPaparoz

Reputation: 58

You should instantiate it as a child object of Canvas.

Instantiate(prefab, thatCanvas.transform);

Upvotes: 1

Related Questions