unity find component in gameobject code example
Example 1: findobject getcomponent
GameObject.Find("Name of the object you want to access").GetComponent<Name of the Component (Transform,Script,RigidBody,etc..)();
An Example (easy to understand):
GameObject Player = GameObject.Find("Player");
PlayerController PlayerControllerScript = Player.GetComponent<PlayerController>();
PlayerControllerScript.run = true;
Another Example:
GameObject.Find("Player").GetComponent<PlayerController>().run = true;
Example 2: unity gameobject.getcomponent
rb = GetComponent<Rigidbody>();