Author Topic: The right way to make a UI prefab  (Read 1320 times)


  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
The right way to make a UI prefab
« on: April 17, 2016, 12:46:09 PM »
Hey Guys,

I am quite new to Unity and NGUI but I really like it. However, I'd like to do things right and I can't find an answer to this question. I have read few things about the performance issues and drawcalls of some GameObjects such as panel, widget... which makes me think what should I use to make a simple UI prefab.

Let's say I want to make an UI prefab for challenge request. That would include challenger's profile picture, username and accept and decline button.
My question is, what should be the container for all of those elements?

I have tried several options:
  • I have created a simple GameObject and within that object I have added a child UI Texture that would act as a background. Here I have encountered an issue. When I moved or resized the UI Texture, GameObject's gizmo thingy was no longer in the center of the UI Texture. So I assumed that wasn't the right approach.
  • Then I tried omitting the GameObject creation and just make a simple UI Texture and put all the elements (like accept and decline button, profile picture etc) as child elements of the UI Texture. However, that doesn't feel right and I've never seen it in any of the tutorials.
  • I have also tried to put elements into an UI Widget container. That worked as I was expecting, but is that right? Or should that rather be an UI Panel?

I am so confused and I can't find any tutorial where they actually make such prefabs...

Can anyone help here?

Many thanks! :)