Search code examples
c#unity-game-enginescriptable-object

Can't be assigned scriptable object to state variable in game object


As I said in the title, I can't assign my ScriptableObject to a "state" variable.

I created 2 different ScriptableObjects (with 2 different scripts), their names "Starting State" and "Heaaad":

Those are scriptable objects

And then I created 2 State variables to assign ScriptableObjects.

  1. A state for my story
  2. A state for my header (title)

I can assign my "Starting State" object to my "Starting State" state, but I can't assign my "Heaad" object to "Head State" state, even though I did the same thing with both objects.

The "Heaaad" ScriptabeObject shows this error in the Inspector: "Heaaad" ScriptableObject gives this error

The "Heaaad" ScriptableObject's C#: "Heaaad" ScriptableObject C# code

The "starting state" ScriptableObject's C#: "Starting State" ScriptableObject C# code

The state variables: Those are States

I don't understand what I did wrong.


Solution

  • The name of HeadHolderScoob doesnt match with the filename "HeadHolderSCOOB.cs" Be sure the class is the same name in the file name (the capital letters in this case doesnt match)

    Our welcome