I am creating a modular state machine called SabiStateMachine
I have a list of a custom class called States ( this custom class is called SabiState and the list of this custom class is called States)
The SabiState class has list of some other custom classes ( code example is given below )
Everything works without any problems .
I use the inspector to add new SabiState elements to the States List ( by clicking on the + button on the inspector ) .
But every time i add a new element its also copies the data from the previous element.
Example: Lets say i created a new element from the inspector and a new SabiState is added to the list
I give a value to the stateName variable of this element
The next time i create a new element, instead of this new stateName of this sabiState instant to be empty, its comes the value of the previous sabiState instance
How can i fix this ?
The List of custom class
public List States;
The class SabiState is given below
[System.Serializable]
public class SabiState
{
public string stateName;
public List actionList;
public List transitionList;
}
The class SabiActionBase is given below
public abstract class SabiActionBase : MonoBehaviour
{
public abstract void ActionStart();
public abstract void ActionUpdate();
public abstract void ActionExit();
}
The class DecisionAndTransition is given below
[System.Serializable]
public class DecisionAndTransition
{
public bool IsActive = true;
public string transitionName = "";
public SabiDecisionBase decision = null;
public string OnTrueTransition = null;
public string OnFalseTransition = null;
}
![alt text][1]
↧