Issue #396 invalid
Former user created an issue

Hello!

I have a class where serialization not working. Here is the code:

public class AtStateActivator : SerializedMonoBehaviour {

[OdinSerialize, ShowInInspector]
Behaviour[] components;
[OdinSerialize, ShowInInspector]
GameObject[] objects; 
[OdinSerialize, ShowInInspector, TableList]
State[] states;    !!!!!!!!!!!! THIS ARRAY IS NOT SERIALIZED !!!!!!!!!!!!

void SetActivity(bool isActive){
    foreach (Behaviour comp in components)
        comp.enabled = isActive;
    foreach (GameObject obj in objects)
        obj.SetActive(isActive);
}

void Start () {
    SetActiveOnState();

    foreach (State state in states)
        CustomStateMachine.StartListeningChanges(state.name, SetActiveOnState);
}

void SetActiveOnState(){
    bool enabled = false;
    foreach (State state in states)
        if (CustomStateMachine.GetState(state.name) == state.value) {
            enabled = true;
            break;
        }
    SetActivity(enabled);
}

void OnDestroy()
{
    foreach (State state in states)
        CustomStateMachine.StopListeningChanges(state.name, SetActiveOnState);
}

}

And afer some time I starting to get error:

Encountered invalid entry while reading serialization data for Unity object of type 'AtStateActivator'. Please report this issue at 'https://bitbucket.org/sirenix/odin-inspector/issues', and copy paste this debug message into the issue report, along with any potential actions or recent changes in the project that might have happened to cause this message to occur. If the data dump in this message is cut off, please find the editor's log file (see https://docs.unity3d.com/Manual/LogFiles.html) and copy paste the full version of this message from there.

Data dump:

Reader type: SerializationNodeDataReader
Nodes dump:

- Name: 
  Entry: Invalid
  Data: 
- Name: 
  Entry: Invalid
  Data: 
- Name: 
  Entry: Invalid
  Data: 
- Name: 
  Entry: Invalid
  Data: 
- Name: 
  Entry: Invalid
  Data: 
- Name: 
  Entry: Invalid
  Data: 
- Name: 
  Entry: Invalid
  Data: 
- Name: 
  Entry: Invalid
  Data: 
- Name: 
  Entry: Invalid
  Data: 
- Name: 
  Entry: Invalid
  Data:

UnityEngine.Debug:LogError(Object) Sirenix.Serialization.CustomLogger:LogError(String) (at F:/Sirenix/Sirenix Solution/Sirenix.Serialization.Config/CustomLogger.cs:53) Sirenix.Serialization.DebugContext:LogError(String) (at F:/Sirenix/Sirenix Solution/Sirenix.Serialization/Misc/SerializationConfig.cs:193) Sirenix.Serialization.UnitySerializationUtility:DeserializeUnityObject(Object, IDataReader) (at F:/Sirenix/Sirenix Solution/Sirenix.Serialization/Utilities/UnitySerializationUtility.cs:1407) Sirenix.Serialization.UnitySerializationUtility:DeserializeUnityObject(Object, SerializationData&, DeserializationContext, Boolean, List1) (at F:/Sirenix/Sirenix Solution/Sirenix.Serialization/Utilities/UnitySerializationUtility.cs:1234) Sirenix.Serialization.UnitySerializationUtility:DeserializeUnityObject(Object, SerializationData&, DeserializationContext, Boolean, List1) (at F:/Sirenix/Sirenix Solution/Sirenix.Serialization/Utilities/UnitySerializationUtility.cs:1199) Sirenix.Serialization.UnitySerializationUtility:DeserializeUnityObject(Object, SerializationData&, DeserializationContext) (at F:/Sirenix/Sirenix Solution/Sirenix.Serialization/Utilities/UnitySerializationUtility.cs:994) Sirenix.OdinInspector.SerializedMonoBehaviour:UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize() (at F:/Sirenix/Sirenix Solution/Sirenix.Serialization/Unity Integration/SerializedMonoBehaviour.cs:25) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

How can I fix it?

Comments (2)

  1. Tor Esa Vestergaard

    I recommend you update to 2.0, which is likely to have a fix for this. Also, do not use [ShowInInspector] on anything you want serialized, as that will merely be confusing. If it is serialized, it will show up on its own. If you have to use [ShowInInspector] to make something show up, it is not being serialized, for some reason or other.

  2. Tor Esa Vestergaard

    Given the lack of reproduction steps and an anonymous reporter, I am marking this issue as invalid for now to keep the repository cleaner. If the reporter (or someone else) replies to this issue with more information and reproduction steps, the issue will be reopened.

  3. Log in to comment