playMaker

Author Topic: Change textures at Multiple GUI Buttons  (Read 1951 times)

MZK

  • Playmaker Newbie
  • *
  • Posts: 5
Change textures at Multiple GUI Buttons
« on: January 09, 2014, 03:04:32 AM »
hey all

I created a row of 12 buttons by customizing the GUI button action.
what i did was i added a for loop to the OnGUI() function.
the code for the OnGUI() looks like this:
Code: [Select]
public override void OnGUI()
{
base.OnGUI();
bool pressed = false;
for(int i = 0; i < ButtonAmount.Value; i++)
        {
if (GUI.Button(new Rect((Screen.height/9)*i, top.Value, Screen.height/10,
Screen.height/10), content, style.Value))
{
storeResult.Value = i;
Fsm.Event(sendEvent);
pressed = true;
}
}

if (storeButtonState != null)
{
storeButtonState.Value = pressed;
}
}

The buttons are functioning as they should, except the Textures.
i want at least 3 textures to switch at each click for each button.

already tried using arrays that's holds the textures but without success.

help will be most appreciated
tnx

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Change textures at Multiple GUI Buttons
« Reply #1 on: January 24, 2014, 07:35:11 AM »
Hi,

You should definitly be using a better 2d framework like 2dtoolkit or ngui or Daikon forge.


 Bye

 Jean