Author Topic: Best practices for in-game GUI  (Read 3959 times)

4everlove

  • Guest
Best practices for in-game GUI
« on: October 15, 2012, 04:22:09 AM »
Due to the limitation of default button components, I create several customized button classes (e.g., BuildButton) and make corresponding prefabs because all these customized buttons share some parameters. However, I have many different levels in my game, so I create a GUI prefab, then in other maps I can simply drag GUI prefab to the scene then everything is done. Here comes the problem. If I add the game objects created by custom button prefabs, then apply the change to GUI prefab. I will lose the connection between customized button game objects and original prefabs. There are tens of these buttons so it's annoying to modify them one by one if I have to change some parameters in the BuildButton prefab. Is there any solution for my situation? thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best practices for in-game GUI
« Reply #1 on: October 15, 2012, 06:19:27 AM »
Unity 4 has a nested prefab feature that may be helpful for you here. Other than that, I can't suggest much.

4everlove

  • Guest
Re: Best practices for in-game GUI
« Reply #2 on: October 15, 2012, 08:52:38 PM »
Unity 4 has a nested prefab feature that may be helpful for you here. Other than that, I can't suggest much.

Thanks Aren, how did you usually organize GUI with customized and replicable objects shared by multiple maps?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best practices for in-game GUI
« Reply #3 on: October 16, 2012, 08:38:57 AM »
I have not yet migrated to Unity 4, so I can't take advantage of the nested prefabs. In Windward I just have one "common prefab" that contains everything shared between scenes -- from item databases to the UI layout. Since all maps are different, I may change the values of some scripts on that prefab, but it mostly remains untouched.