Author Topic: Playmaker & iGui integration - activate/deactivate button  (Read 2556 times)


  • Playmaker Newbie
  • *
  • Posts: 16
    • View Profile
Playmaker & iGui integration - activate/deactivate button
« on: October 21, 2014, 03:32:30 AM »
Hello, I  tryed to create simple mute/unmute music system with iGui and Playmaker.

I Created Two buttons on the same location:
- Music is on press to turn off (button1)
- Music is off press to turn on (button2)

So when you press one button it will make some "mute" actions , deactivate byself and activate second button.

But I had problems with activate/deactivate iGui buttons by using Playmaker.

I tryed to call event and use Set Propery action to enable/disable button:

But this don't work. It's should toogle On/Off "Enable" box but when I used that, it's only  enabled/disabled iGuiButton script :(.

When it's disabled iGuiButton script, the button is still visibile...
Even if i disable whole Button 1 object  in Hierarhy it's still visible...
I tryed to give button Layer and disable  this layer in camera culling mask, but guess - button is still visible... iGui is very funny with this problem...

So I created playmaker system that by pressing  button it will change opacity, passive and order states for both buttons.

First you must to create a two buttons by using iGui.
After that  in the inspector,  check Passive box to true, set opacity to 0, and set order to 0 for button 2:

It will "disable" this button on the start:).

For the button 1 set "order" value to 1.

After that you must enter code into iGui Root Script -  that will call events
( I wrote "//add this" too mark, where I put new code:)

Code: [Select]
using UnityEngine;
using System.Collections;
using iGUI;
using HutongGames.PlayMaker;  //add this

public class iGUICode_PlayMakerPlusIgui : MonoBehaviour{
public iGUIButton button2;
public iGUIButton button1;
public iGUIPanel panel1;
public iGUIRoot root1;

public PlayMakerFSM behavior; //add this

static iGUICode_PlayMakerPlusIgui instance;
void Awake(){
public static iGUICode_PlayMakerPlusIgui getInstance(){
return instance;

public void button1_Click(iGUIButton caller){

behavior.Fsm.Event("TurnOffButton1TurnOnButton2Event"); //add this


public void button2_Click(iGUIButton caller){
behavior.Fsm.Event("TurnOffButton2TurnOnButton1Event"); //add this


After inserted that codes to the iGui Root script you must move object with playmaker actions to the iGui Root, Behavior area:

Ok, now I will show you what I have made in playmaker:

So if you press button 1 it will call "TurnOffButton1TurnOnButton2Event"
If you press button 2 it will call TurnOffButton2TurnOnButton1Event"

Those both events are global events.

"Wait for global event" is empty.

Init and Init2 events:

Turning On Button 2 Event:

Remember to put into Set Property action in "Target object" area not a Button object but "IGUIButton" component:

Turning Off Button 1 Event:

Turning On Button 1 Event:

Turning Off Button 2 Event:

"Wait for global event" and "Wait for global event 2" are empty events.

Mayby it will be useful for somebody :)


« Last Edit: October 21, 2014, 10:56:59 AM by KrzysztofZuk »