Hello Guest

Author Topic: 2d UIItem Additional Parameter  (Read 3706 times)

Wrosgar

  • Newbie
  • *
  • Posts: 2
    • View Profile
2d UIItem Additional Parameter
« on: February 01, 2014, 01:47:47 am »
Hi there,

I'm trying to modify the script Tk 2D UIItem so that I can add an extra parameter when I want to send the message to the target. I want to add an int as I have a scrollable screen with >20 buttons and having each one send to a different function is frustrating. Having something more dynamic, so I can have a public int would be much more convenient.

Why is it that a public variable isn't showing up in the inspector when I add it to the script?

Wrosgar

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: 2d UIItem Additional Parameter
« Reply #1 on: February 01, 2014, 03:51:43 am »
Nvm I figured it out.

Turns out tk2dUIItemEditor is overwriting OnInspectorGUI so we had to add it there.

We also wanted it so that we could make our SendMessage include an int, so we had to do some extra scripting in UIItem so that if it was default 0 it would continue with just the string, otherwise it would send the int value we want.

We also had to go into MethodBindingHelper so that functions with both 0 and 1 parameter would show up. Not the greatest work around in the world, but hey it works and now we can use it the way we want!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2d UIItem Additional Parameter
« Reply #2 on: February 01, 2014, 02:50:40 pm »
Glad you've got a solution :)