GameObject VS Transform in Unity

In Unity, GameObject is the base class for all objects in the scene. It contains Transform components to represent the object's position, rotation and scale in the scene.

GameObject in Unity is a basic object, which can represent various objects in the scene, such as characters, props, lights, cameras, etc.12. GameObject itself has no function, it needs to add components to define its properties and behavior. Components can be built into Unity or scripts you write yourself.

For a character in Unity, each bone usually has a corresponding GameObject. The reasons are as follows:

  • Unity's animation system realizes character animation by moving and rotating the Transform of GameObject.
  • Creating a GameObject for each bone allows each bone to have its own Transform.
  • The Animator component can control the Transform of sub-objects to achieve skeletal animation.
  • Adding other components (such as bone lines) also requires a GameObject as a carrier.

So in Unity, skeletal animation basically adopts the method of one GameObject per bone.

For example, for human characters:

  • The leg bone will have a GameObject for UpperLeg, LowerLeg and Foot.
  • Arm also has UpperArm, LowerArm and Hand GameObjects.
  • The head and torso also each have a GameObject.
  • The Animator component is added to the root object and controls the animation of all skeletal GameObjects.

 

Guess you like

Origin blog.csdn.net/u010087338/article/details/131865677