Last active
August 29, 2015 14:10
-
-
Save stepheng/11e605f27307795f61eb to your computer and use it in GitHub Desktop.
PlayMaker - GuiButtonSetStringValue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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