According to Unity’s scripting API, the following are valid options for the Component.GetComponent method: code example

Example 1: how to get component in unity c#

GetComponent<Rigidbody>(); //used to find component on character (rigid body can be changed)
GameObject.FindGameObjectWithTag("player"); //finds any game object in the scene with this tag

Example 2: getcomponent

ur so stoopid u dum its eeeeeeez to use getcomponent jkust doo

Getcomponent<*A component to get*>().*the thing you need in the component* *100/= true/= false/ color.red