Loaded ScriptableObject is null but has value when using Fast enter play mode

Hello,

I’m using scriptable object combined with addressable for my ability system.
I have been strugulling with an peculiar issue when using the fast “enter play mode” option of the editor.

I display some information about the ability on screen and some data is not displayed but others are.
If i have the domain reload option ticked I have no issue but If I don’t reload the domain on enter play mode I end up with a null reference on my scriptableobject while it has data.

In my code I do some null check on the ability to gard against null pointer but in that case even if the oject is considerd null, I do have all the expected values…

Fast enter play mode without issue (which is no longer fast enter play mode in that configuration…)
7136630--853307--upload_2021-5-13_11-41-10.png

1 Like

I have worked around it by making an ugly copy of the ability loaded through addressable to a new instance of the scriptable object.

public static ScriptableAbility CopyOf(ScriptableAbility original)
    {
        ScriptableAbility copy = new ScriptableAbility();
        copy.Id = original.Id;
        copy.Icon = original.Icon;
        copy.Name = original.Name;
        copy.Range = original.Range;
        copy.Spawnables = original.Spawnables;
        copy.Timings = original.Timings;
        copy.Costs = original.Costs;
        copy.Effects = original.Effects;
        return copy;
    }
  1. it’s ugly
  2. it adds maintenance cost
  3. it probably create more GC
1 Like

In fact, the “Fast enter play mode” does not reload the asset,if I change the icon for instance, it does not update until I reload the domain.

1 Like