So i've been trying to make a Menu system when a user clicks on a button, it would set a variable then change states, the only work around, was to have a transition on every button, but what if you didn't want a transition or what if you have a number of selections?
I needed to add some way to force a variable, so i merged the "set string" into the "GUI Button"
simply click on the gear for "GUI Button" and select EDIT, then copy paste this over the original
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.
using UnityEngine;
using System.Collections.Generic;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.GUI)]
[Tooltip("GUI button. Sends an Event when pressed. Optionally store the button state in a Bool Variable.")]
public class GUIButton : GUIContentAction
{
public FsmEvent sendEvent;
[UIHint(UIHint.Variable)]
public FsmBool storeButtonState;
//
public FsmString stringVariable;
public FsmString stringValue;
//
public override void Reset()
{
base.Reset();
sendEvent = null;
storeButtonState = null;
style = "Button";
}
public override void OnGUI()
{
base.OnGUI();
bool pressed = false;
if (GUI.Button(rect, content, style.Value))
{
Fsm.Event(sendEvent);
stringVariable.Value = stringValue.Value;
pressed = true;
}
if (storeButtonState != null)
{
storeButtonState.Value = pressed;
}
}
}
}
The reason I'm posting the code is so others who maybe more experienced in modifying it, can update it without uploading unnecessary files and versions
I really did this blind folded knowing nothing about the format of how to make actions, I just hope i got it right