Everts
Everts

Reputation: 10721

Unity 5.4 - broken serialization

It seems as if Unity 5.4 has a serialization issue:

public class InputManager : MonoBehaviour 
{
    [SerializeField] private MyObject obj;
}

[Serializable]
public class MyObject¨
{
}

results in :

InvalidOperationException: The operation is not possible when moved past all properties (Next returned false)

Am I doing it wrong?

Upvotes: 2

Views: 3540

Answers (2)

Meep Teepo
Meep Teepo

Reputation: 43

Had this issue when using the debug Inspector and disabling it and just using the normal Inspector cleared the error. My guess is it has something to do with the private fields being visible like Serialized Fields.

Upvotes: 0

You should put some public fields in the class you want to serialize. If it's empty, or only has private or protected fields, there's nothing to serialize. The error message could have been better (something like "nothing to serialize" instead of the one you're getting).

Upvotes: 1

Related Questions