Hello,
Since with Unity 2020.1 we’re now able to serialize generic types, I was wondering if its possible to make the
ScriptableObject.CreateInstance<GenericScriptableObject<...>()>
works too in order to not to have to implement a non-generic class before.
For exemple I have,
public class Variable<T> : ScriptableObject
{
private T _value = default;
public T Value
{
get => _value;
set => SetValue(value);
}
public void SetValue(T value)
{
_value = value;
}
}
and I want to be able to do
public Variable<float> floatVariable;
void Start()
{
floatVariable = ScriptableObject.CreateInstance<Variable<float>>();
}
(For now ScriptableObject.CreateInstance<Variable>() just returns null)
Thanks !