Accesing scripts from other objects

Hello dear scripters i was wondering how can i acces a script from another object the object is a slider in canvas and iam tryng to acces it from a game object cube
I was tryng this
On the sliders script i worte this
Namespace Somescript
{}
And on the cube i wrote
Using Somescript
But it doesnt work how can i acces it

You need to get the object first, either with GameObject.Find(name) (Don’t, just don’t) GameObject.FindGameObjectWithTag(tag) (Better) or by creating a public variable and assigning the slider by hand (Best). Then you can do this in code: foundGameobject.GetComponent().field/method you want to access

So in the void star i need to write the 3rd option right ?

yes

Thank you i will try it :slight_smile: