When my player inputted the wrong answer, I needed an action that reset it, so it didn't stay the next time they tried to enter one. With the help of Chris, this is what I got that worked.
using UnityEngine;
using System.Collections;
using UnityEditor;
namespace AC
{
[System.Serializable]
public class ActionResetVariable : Action
{
public string MenuName;
public string InputName;
public ActionResetVariable ()
{
this.isDisplayed = true;
title = "Variable: Reset";
}
override public float Run ()
{
AC.MenuInput inputBox = (AC.MenuInput) AC.PlayerMenus.GetElementWithName (MenuName, InputName);
inputBox.label = "";
return 0f;
}
override public void ShowGUI ()
{
MenuName = EditorGUILayout.TextField ("Menu Name:", MenuName);
InputName = EditorGUILayout.TextField ("Input Field Name:", InputName);
AfterRunningOption ();
}
}
}
Comments
thank you