Author Topic: [REQUEST]: EventDelegate, expose properties  (Read 4611 times)

helmesjo

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 116
    • View Profile
[REQUEST]: EventDelegate, expose properties
« on: April 05, 2014, 12:42:13 PM »
Hi!

As the title describes, it would be extremely useful if the EventDelegate exposed properties also, now that arguments are supported. In my case, I just want an easy and "Inspector-only" solution to toggle the state of an UIToggle. I'm guessing it should be possible...

TY!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [REQUEST]: EventDelegate, expose properties
« Reply #1 on: April 06, 2014, 02:37:03 AM »
Hmm? If you choose a target function that has parameters, you will see those parameters in inspector.

helmesjo

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 116
    • View Profile
Re: [REQUEST]: EventDelegate, expose properties
« Reply #2 on: April 08, 2014, 02:27:35 PM »
Hmm? If you choose a target function that has parameters, you will see those parameters in inspector.

Of course! I meant the list of methods to invoke, which won't show properties (eg. UIToggle.value). Haven't looked over your implementation, but I can't imagine it being to much effort since properties are more or less syntactic sugar for a getter & setter-method (you'll probably expose those two separate i guess...).
A followup request for this is the ability to set constant values as parameter. In the case with a UIToggle, it would be extremely convenient to be able to set the method to "value" and pass "true" as parameter when some arbitrary event fires, or if I want to change the value of a label to some constant string when a button is clicked etc.

These are just my 2 cents on the next step to make NGUI more "inspector-only"!

Cheers!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [REQUEST]: EventDelegate, expose properties
« Reply #3 on: April 09, 2014, 03:09:43 AM »
Properties/variables are very different from functions. You set properties. You call functions. This inherent difference makes them incompatible.

Keep in mind you can always bind one property to another if you want them linked. So if you wanted UIToggle.value to always be linked to say, enabled state of some game object, then do just that -- attach a Property Binding component and link the two together.