How do I change a state in an FSM with an UI button?
I'm trying to change from the abandoned state to adopted state, but i can't seem to find the available button function in the inspector.
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class CatRescueFSM : MonoBehaviour {
public enum catState
{
CAT_ABANDONED,
CAT_ADOPTED,
CAT_HUNGRY
}
public catState currentCatState;
void Start()
{
currentCatState = catState.CAT_ABANDONED;
}
public void RunCatAdoptedState(catState CAT_ADOPTED)
{
currentCatState = catState.CAT_ADOPTED;
}
}
Comment
Your answer
Follow this Question
Related Questions
UI Button OnClick Only Works the First Time 2 Answers
is it possible to have two on click events in one button 1 Answer
How to disable button text UI 0 Answers
UI button events not working on android 3 Answers