unity use gameobject in script code example
Example: c# unity gameObject.script
void Update()
{
string Thing = gameObject.GetComponent<CustomScriptName>().Variable;
if (Thing == "String1")
{
DoStuff();
}
if (Thing == "String2")
{
DoOtherStuff();
}
}