Code inspection: Expected a type derived from 'ScriptableObject'
This inspection ensures type safety for Unity's string-based ScriptableObject creation API, specifically targeting the ScriptableObject.CreateInstance(string) method.
How it works
The inspection uses Unity-specific reference providers to resolve the string literal to a type declaration within the project or libraries. Once the type is resolved, the analyzer checks its inheritance hierarchy.
Validation rule: The resolved type must derive from UnityEngine.ScriptableObject.
If the resolved type exists but does not inherit from ScriptableObject, the inspection produces a warning. This prevents runtime errors where Unity would fail to instantiate the object because the specified type is not a valid ScriptableObject.
Example
In this example, MyPlainClass does not inherit from ScriptableObject, so it cannot be instantiated using CreateInstance.