How do I access a gameobjects variables in a seperate script?

I have a script attached to a popup list. In this script I want to change texture on a different game object. I think I have the scripts down, I just don’t know how to access the renderer of the other gameobject since the script is not attached to it.

Do I need to put a script on each of those objects that just instantiates a variable for the gameobject and assign that to a public variable in the Start section or is there an easier way?

Based on above comments, since you know the identity of the gameobject in advance, you could add a gameobject property to your popup script and set that to the relevant gameobject in the inspector.

Try this

GameObject.Find("goName").GetComponent<MeshRenderer>().material.mainTexture = newTexture;

Like Sundar said, I think what you want is use GameObject.Find and GameObject.GetComponent (Unity - Scripting API: GameObject.Find )(Unity - Scripting API: GameObject.GetComponent)

Then you can do something like Sundar said.

If, besides this, you want to access some scripts variables, and not just get components, you have to make this variables public (if there is any specifying it, they you be private) or, to be follow programming principles, make set and get functions for the variables that you want access.