In C# it’s a piece of cake to create instance of ScriptableObject. I try to do the same with UnityScript.
//MyMonoBehaviorClass.js
var mScriptableObject = ScriptableObject.CreateInstance(typeof(MyScriptableObjectClass));
mScriptableObject.foo();
//=================================================================
//MyScriptableObjectClass.js
class MyScriptableObjectClass extends ScriptableObject
{
function foo()
{
print("Hello from foo()!");
}
}
I get error: “ScriptableObject.CreateInstanceFromType can only be called from the main thread.” What’s wrong?