- Home /
Instancing ScriptableObject not saved in assets results in warning message
If I run the following:
var myObject = ScriptableObject.CreateInstance<MyScriptableObject>();
var myClone = Instantiate(myObject);
I receive the following warning in the logs (Without stacktrace. Only the following text):
"No script asset for Test. Check that the definition is in a file of the same name."
It still clones the type correctly. But is there a way I can go without getting this warning message?
Frankly I don't understand what it's complaining about. I can instantiate GameObjects, materials, and whatnot that's not saved as an asset to in my project, but when I do it with ScriptableObjects it complains.
I have currently reverted to storing the myObject among my assets and dragging in the MyScriptableObject reference from there, something like:
public MyScriptableObject myObject;
private void Awake()
{
var clone = Instantiate(myObject);
}
Which works, but is bit excessive as I only use the MyScriptableObject type for keeping temporary data anyway, and is irrelevant to try configure it via the inspector as it's 100% controlled by other code from my mono behaviours..
Anyone knows anything about this? Kind regards.