Help with accessing variables from other scripts

I apologise for not having a very good programming vocabulary, I’m new to Unity.

Basically I have a “score” variable that is declared in a “GameManager” script ; I then have another script in which I want to increment it when a condition is met.
(can’t put both in the same script because in the future multiple gameObjects will need to be able to increment the score)

I’ve tried to look into other online discussions, but for all of them, the step of dragging the GameManager object to the linked variable box on the right isn’t even mentionned, as it is supposed to be trivial.
However for some reason Unity won’t let me drag it into the box.

Here’s an unlisted video of me trying to link the two game objects (bc apparently we can’t attach video files)
https://www.youtube.com/watch?v=MmxTwcYodIQ

Hi,
You should have an gameobject “baseball” with the baseball script attached to it and then you drag the gameobject gamemanager to the script on that object. You can’t drag to a script directly.

As @Happy-Zomby said, you can’t drag a scene gameobject (your GameManager in your hierarchy) to a “project” script, but you can search for an instanciated GameManager when your baseball is created.
To do this, in your Baseball.cs script, write in your Start function :

gameManager = GameObject.Find("GameManager");

(But, with this method, if your scene gameobject GameManager changes name, it won’t work anymore, so a better practice would be to use FindGameObjectWithTag. Please look at Finding in Unity - Manual: GameObject)