Author Topic: Creating a prefab  (Read 6105 times)

wijesijp

  • Guest
Creating a prefab
« on: February 21, 2013, 06:06:23 AM »
In my game menu system i have a set of controls that are repeating (title, image, description, button).

Is it possible to group them and make a prefab then reuse it?

It is similar to example "Example 7 - Scroll View (Panel)" Instead of creating each item individually,  i would like to create item as a prefab and then reuse it. Can this be done?
« Last Edit: February 21, 2013, 06:40:11 AM by wijesijp »

wijesijp

  • Guest
Re: Creating a prefab
« Reply #1 on: February 21, 2013, 10:33:45 PM »
bump .....

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Creating a prefab
« Reply #2 on: February 21, 2013, 10:46:23 PM »
Why wouldn't it be?

wijesijp

  • Guest
Re: Creating a prefab
« Reply #3 on: February 21, 2013, 11:31:56 PM »
I want the menu to have 1 panel. So I group bunch of buttons and created a prefab without the panel. Then I put that prefab inside the panel and it didn't work. There is no example that i can find showing how to do this. for example "Example 7 - Scroll View (Panel)" all the item parts created individually. I would use a prefab for the repeating parts ...

Is there any example showing how to do this?
« Last Edit: February 21, 2013, 11:35:39 PM by wijesijp »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Creating a prefab
« Reply #4 on: February 23, 2013, 02:43:08 AM »
Use NGUITools.AddChild to add them. The inventory example's backpack is instantiated like that.