Author Topic: Extending NGUI inspectors.  (Read 3763 times)

artfabrique

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 45
    • View Profile
Extending NGUI inspectors.
« on: October 27, 2015, 07:26:28 AM »
Good day, sir!
What is the best aproach to writing custom additional editor fields for NGUI widgets?
Our game is very "interfaces-heavy" and it is very hard to maintain styles across the whole project.
We want to create something like styles selector&editor for different NGUI objects. For example text size/color/fx. Sprites size/solor etc.
Like presets.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Extending NGUI inspectors.
« Reply #1 on: October 29, 2015, 07:23:08 AM »
If I was doing it... I'd approach it by attaching a custom script to each widget that's marked as [ExecuteInEditMode]. Inside this script I would have a field that specified what type of a color this widget should be affected by, such as "foreground", "background", "text", etc. I would then set the widget's color in the Update() function after checking to see if the color is actually changing (otherwise the scene will constantly be marked as edited).

I would also add a Start() function that will destroy the script if the application is playing, so that it's not there at run-time.