Hey guys I keep getting an error when I try to serialize a list of a class that I made
[Serializable]
public class DialogItem
{
public bool show = true;
public Speakers speaker = Speakers.NPC;
public string AudioClipRef;
public string subtitle = "(enter subtitle text)";
public string AnimationToPlay;
[XmlIgnore]
public AudioClip spoken = null;
public Waits wait = Waits.Audio;
//public bool show_camera = true;
//public Perspectives perspective = Perspectives.Classic_Two_Shot;
//public Angles angle = Angles.level;
//public Distances distance = Distances.medium;
//public Sides side = Sides.left;
public bool is_branch = false;
public List<String> choice;
public List<int> jump;
public List<NodeAction> onNodeFocusedActions = new List<NodeAction>(),
onNodeLeaveActions = new List<NodeAction>();
//public bool has_action = false;
//public string ActionMethod;
//public string ActionParameter;
public DialogItem()
{
}
public void Initialize()
{
if(AudioClipRef != String.Empty)
{
spoken = (AudioClip)Resources.Load(AudioClipRef);
}
}
#if UNITY_EDITOR
public void BuildForSerialize()
{
AudioClipRef = AssetDatabase.GetAssetPath(spoken);
}
#endif
}
The part throwing the error is the List it keeps telling me that my node actions are not primitive objects. Here is the code for the node actions.
[System.Serializable]
public class NodeAction
{
public void Initilize(GameObject owner)
{
Debug.Log("Adding Component with type of: " + GetType());
NodeActionComponent.LinkNodeAction(owner, this);
}
#if UNITY_EDITOR
public virtual void OnInspectorGUI(){}
#endif//end unity editor region
}
[System.Serializable]
public class NodeActionLookAt : NodeAction
{
public int target;
#if UNITY_EDITOR
public override void OnInspectorGUI()
{
target = EditorGUILayout.IntField("Test", target);
}
#endif
}
Im really at a loss and have no idea what to do. The exact error is: InvalidOperationException: The type of the argument object ‘NodeActionLookAt’ is not primitive. Any help would be appreciated. Thanks!