I have a type "Triggers.Trigger" that derives from ScriptableObject:
namespace Triggers {
public class Trigger : ScriptableObject {
}
}
I am trying (and failing) to create new instances of it:
(Trigger) ScriptableObject.CreateInstance(Trigger);
(Trigger) ScriptableObject.CreateInstance(typeof(Trigger).ToString());
(Trigger) ScriptableObject.CreateInstance();
(Trigger) Trigger.CreateInstance();
results in `Instance of Trigger could not be created because there is no script with that name`
(Trigger) Trigger.CreateInstance();
results in `The type arguments for method `UnityEngine.ScriptableObject.CreateInstance()' cannot be inferred from the usage. Try specifying the type arguments explicitly`
(Trigger) ScriptableObject.CreateInstance("Trigger");
results in `Instance of Trigger couldn't be created. The the script class needs to derive from ScriptableObject.`
Specifically, I have a manager class that has a `List`, and I'm trying to programmatically create them.
Why is this failing and what can I do to fix it?
↧