Use CreateInstance() to create a ScriptableObject. To handle Unity message methods, the Unity engine needs to create the ScriptableObject.
using UnityEngine;
class Foo : ScriptableObject { }
class Camera : MonoBehaviour
{
public void Update() {
Foo foo = new Foo();
}
}
Use ScriptableObject.CreateInstance():
using UnityEngine;
class Foo : ScriptableObject { }
class Camera : MonoBehaviour
{
public void Update() {
Foo foo = ScriptableObject.CreateInstance<Foo>();
}
}
A code fix is offered for this diagnostic to automatically apply this change.