unity get script's gameobject code example
Example 1: unity get script from gameobject
obj.GetComponent<Script>();
Example 2: c# unity gameObject.script
void Update()
{
string Thing = gameObject.GetComponent<CustomScriptName>().Variable;
if (Thing == "String1")
{
DoStuff();
}
if (Thing == "String2")
{
DoOtherStuff();
}
}