Unity - Adding Basic components to the GameObject

Matthew·2024년 8월 16일
0

Unity

목록 보기
4/9

Adding RigidBody 2D

RigidBody 2D adds 2D physics(falling for example) to the gameObject.

  • Select AddComponent and type RigidBody 2D
  • Adding RigidBody 2D will enable the gameObject to interact with eachother.

Adding Collider 2D

Collider 2D defines the physical shape of a 2D GameObject for the purposes of physics interactions.

  • Allows the gameObject to collide with other gameObjects and trigger events.

Adding Scripts 1

By adding a script to the game object, you can define how the gameObject behaves.

  • Click on Add Component and type script. Then, name the script and save it.

  • Once you save the script, wait for few seconds and the script should be in your Assets folder.

Adding Scripts 2

I prefer to make a script folder first, and then make a script.

  • Create a new folder under Assests folder.

  • Name the folder and create C# script in it.

  • Make sure to drag and drop the script onto the add component section of the gameObject to apply the script after.
profile
Growing Game Dev

0개의 댓글