Get Component = Component Unity 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: unity gameobject.getcomponent


rb = GetComponent<Rigidbody>();

Comments

Popular posts from this blog

530 Valid Hostname Is Expected When Setting Up IIS 10 For Multiple Sites

C Perror Example

Converting A String To Int In Groovy