Required Odin Inspector for config scriptable object
Setup:
- Create EcsSerializationConfig scriptable object anywhere in your project by pressing 'Assets/Create/Ecs Serialization Config'
- Create new lookup info in it and select your context type and component lookup type
- Add [Serializable] attribute on any component you want to be serialized
- Update EcsSerializationConfig by pressing button on it or 'Tools/Entitas/Update EcsSerializationConfig'
- Create an default instance of context serializer var myContextSerializer = new ContextSerializer<MyContextType, MyEntityType>(new MyComponentSerializer(), EcsSerializationConfigLink)
- Call var contextData = myContextSerializer.Serialize(MyContextInstance) to serialize you context data and store it wherever you want, for example convert it to json and place into PlayerPrefs
- Load and deserialize you context data and call myContextSerializer.Deserialize(loadedContextData, MyContextInstance)
Don't forget to update EcsSerializationConfig every time after Entitas code gen!