エラー内容
MyTable must be instantiated using the ScriptableObject.CreateInstance method instead of new MyTable. UnityEngine.ScriptableObject:.ctor()
原因
上記のMyTableというのは、ScripttableObjectを継承したクラスになる。
このクラスのインスタンスを作成する際に、MyTable table = new MyTable();
と書くと、このエラーが出る。
対処方法
このメソッドを使ってインスタンスを生成する。
public static ScriptableObject CreateInstance(string className); public static ScriptableObject CreateInstance(Type type);
Unity - Scripting API: ScriptableObject.CreateInstance
書き方の例
MyTable table = ScriptableObject.CreateInstance("MyTable") as MyTable;
以上。