Unable to drag and drop script into serializedfield on object component

As the title says.
I’ve Included pics of the code and gif of me trying to drag and drop my GameInput script into the serializedfield on my Player object but it’s not letting me do so.

Can anyone tell me what I’m missing here?

205896-pleasehelpmeh.gif

It’s because Unity is expecting you to drag in a Game Object that contains the script, not the script itself. The script is a MonoBehaviour script so it needs to be on a GameObejct.

You could create a GameMaster game object that contains all scripts that aren’t associated with a specific game object.

For example, game input isn’t something the player needs to have on them. You may still want to read input even if the player object doesn’t exist anymore. So putting the script on an empty game object, and then dragging in the empty game object. :slight_smile: