as gameobject unity code example
Example 1: unity create gameobject
// Use 'new GameObject' to create a new GameObject in the current scene
SpawnedObject = new GameObject("Created GameObject");
Example 2: c# unity gameObject.script
void Update()
{
string Thing = gameObject.GetComponent<CustomScriptName>().Variable;
if (Thing == "String1")
{
DoStuff();
}
if (Thing == "String2")
{
DoOtherStuff();
}
}