It seems that BuildPlayer unloads all ScriptableObject instances from memory during/after a build - I get OnDisable/OnDestroy calls on my objects.
However, it doesn’t appear to reload them afterwards - I don’t get any OnEnable() call.
Is there any way to get my object to survive this process? I’ve tried calling DontDestroyOnLoad() and it doesn’t seem to have helped; I’ve also tried setting HideFlags to None just in case but that also hasn’t helped.
Note that my instance is not associated with an asset - I guess I could create one temporarily but I’d prefer to avoid it if at all possible…
(This is in Unity 4.2.0b2 - if the behaviour is different in newer versions, let me know…)
Confirmed (in 4.3.0b6) that this happens to ScriptableObject instances that aren’t persisted to disk. Ones that are backed by an asset file get reloaded, but ones that aren’t do not.
Filed as bug #572112. I’m half expecting the answer to be “this is by design” but at least then someone will have actually said that