Difference betwwen GameObject and scriptname

Hi !

i create a game using unity and i want to manage scene ( Add score , lifes … );

i use some code like this

var scenemanager : GameObject ;
scenemanager .Dosomething() ;

but i get errors in previous code ( and i don’t why)

so i use another code like this

var scenemanager : scriptname;
scenemanager .Dosomething() ;

and it’ work very good .

my question whats the different betwwen these code ?

Since you’re using the script name for the type, It’s a direct link to the script that’s attached to the object. If you use GameObject for the type, then you have to use GetComponent in order to get the specific component (in this case the script).