I have a ScriptableObject that contains a list of other ScriptableObjects (sub-assets). My main ScriptableObject asset is created through the Create menu in the editor (I’m using the new 5.1 [CreateAssetMenu] attribute). My sub-assets are added via a button on a custom inspector on the main asset. When the button is pushed, those code runs:
It seems like it should work, but when I hit the button to add a sub-asset, I’m getting the following errors:
What on earth does that “AddAssetToSameFile failed because the other asset is not persistent” error mean? O_O I haven’t seen that error referenced anywhere else on the forums or Unity Answers
I just realized I posted this in the Scripting forum instead of the Editor forum. Whoops!
I figured out the issue! I was trying to add a sub-asset to a sub-asset, which apparently Unity doesn’t like So now I’m adding the sub-sub-asset to the main asset, but maintaining a separate list of sub-sub-assets in the sub-asset