I want to create an asset from a scriptable object (let call it SO) and make that asset to be the Selection.activeObject. How can I get that asset file? AssetDatabase.CreateAsset doesn’t return anything and calling AssetDatabase.LoadAssetAtPath is unnecessarily costly (when AssetDatabase.CreateAsset can just return the asset file). I don’t know if there is a better way to do this? Also, I wonder if the new asset has a reference to the SO, or does the CreateAsset function clone the value of SO?
The first argument you pass to the
AssetDatabase.CreateAsset function is the object to create the asset from. Have you tried using this object when setting