You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe that's me dummy-dumb, but I faced next issue:
I create scriptableobject that has SerializableDictionary as field
I fill it with data via inspector (no problems here)
I reload project and all data of ScriptableObject are lost
[Serializable]
public class StringEventDictionary : SerializableDictionary<string, Event> {}
[CreateAssetMenu(fileName = "New GameEvents Data", menuName = "GameEvents Data", order = 54)]
public class GameEventsData : ScriptableObject
{
[SerializeField]
private StringEventDictionary events = null;
public IDictionary<string, Event> Events
{
get { return events; }
set { events.CopyFrom(value); }
}
}
[Serializable]
public class Event
{
public event Action<int> action;
public void EventRunner(int id)
{
action?.Invoke(id);
}
}
The text was updated successfully, but these errors were encountered:
Are you using System.Action in the class Event? System.Action cannot be serialized by Unity. I think this is the cause of the data loss.
If I use a type serializable by unity, I don't observe a data loss when used in a ScriptableObject.
Facing the same issue still in 2024. Funnily, only one of two SOs of same type loses data. the other is fine. They are literally of instances of same type.
Maybe that's me dummy-dumb, but I faced next issue:
The text was updated successfully, but these errors were encountered: