unity get script in gameobject code example Example: unity get script from gameobject obj.GetComponent<Script>();