I tested that separately saving the instantiated Skill works, but that would become too cumbersome. Based on another topic here I also tried adjusting the collectDependenciesDepth (up to 20), but that didn't resolve the issue. Also in case it's relevant, within the scene and before loading I have populated lists of all the available original Character & Skill options. Before entering run mode, I have also tried to refresh the references and separately press the "Add Reference(s) to Manager" on the gameobject that holds the lists of SO's.
Here are the relevant parts of the code simplified:
Code: Select all
public class Character : ScriptableObject
{
public Skill CharacterAbility;
}
Code: Select all
public class Skill : ScriptableObject
{
public int ID;
}
Code: Select all
public List<Character> CharacterTemplates;
public List<Skill> AllSkills;
public Character[] PlayerTeam = new Character[4];
Character NewRandomCharacter = Instantiate(CharacterTemplates[Random.Range(0,CharacterTemplates.Count)];
Skill NewRandomSkill = Instantiate(AllSkills[Random.Range(0,AllSkills.Count)];
NewCharacter.CharacterAbility =NewRandomSkill;
PlayerTeam[0] = NewRandomCharacter;
ES3.Save("PlayerTeam",PlayerTeam);
<RESTART GAME>
PlayerTeam = ES3.Load<Character[]>("PlayerTeam")
---> Character is loaded, but CharacterAbility is not loaded