hi am trying to access a code from one gameobject to another gameobject attached both the scripts

but the problem resides is when i try to access the controller_instant script to the gamemanager its ok all working but
when i want to access the code gamemanagerscript to the controller_script popping the error “Assets/controller_instant.cs(17,17): error CS0266: Cannot implicitly convert type UnityEngine.Component' to gamemanagescript’. An explicit conversion exists (are you missing a cast?)”

plz help me out
uploaded both the files

1897882–122292–controller_instant.cs (970 Bytes)
1897882–122293–gamemanagescript.cs (878 Bytes)

please use code tags for showing scripts.

the error says that your gameManager object is not a unity component and that you can cast it to a component if you wish.

if you don’t know casting check polymorphisme!

you could cast it by putting (Component) in front or as Component behind your instance that needs casting.

Is it a monobehavior? Get it like this!

ScriptName svar = otherObject.GetComponent<ScriptName>();

Is it not a monobehavior? Get it like this!
In this example, ScriptName2 is a non-monobehavior class that is created inside the monobehavior ScriptName.

ScriptName2 sn = otherObject.GetComponent<ScriptName>().script2;

To access say… a data script that is created within a monobehavior and is inside that script, you use the second one. But you still need a monobehavior on that object to get the other script in that object.

thanks got my error corrected .

I have no idea what following means, but thank you.