i have method that creates an asset (AssetDatabase.CreateAsset) from a ScriptableObject instance, and adds other ScriptableObjects to it’s list, then adds (AssetDatabase.AddToObject) these to the asset too. The problem i had was that exactly after i added them, i inspected the asset and all references had become null. I suspected an unintuitive feature of CreateAsset and delayed the AddToObject by an editorupdate after the CreateAsset and this time they didn’t become null refs. My question is:
Is this the ‘correct’ way to do it (Or do i have to expect it to break unexpectedly later on)?
(It seems the CreateAsset call doesn’t actually create the asset right away but queues it for creation somehow, even though this is not mentioned in the documentation, so i’m wondering)