Skip to content

Instantly share code, notes, and snippets.

@stepheng
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stepheng/11e605f27307795f61eb to your computer and use it in GitHub Desktop.
Save stepheng/11e605f27307795f61eb to your computer and use it in GitHub Desktop.
PlayMaker - GuiButtonSetStringValue
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. Set a String var")]
public class GUIButtonSetStringValue : GUIButton
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmString stringVariable;
public FsmString stringValue;
public override void Reset()
{
base.Reset();
stringVariable = null;
stringValue = null;
}
public override void OnGUI()
{
DoSetStringValue();
base.OnGUI();
}
void DoSetStringValue()
{
if (stringVariable == null) return;
if (stringValue == null) {
stringVariable.Value = "";
return;
}
stringVariable.Value = stringValue.Value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment