Animation

class in UnityEngine

/

다음으로부터 상속:Behaviour

매뉴얼로 전환

설명

The animation component is used to play back animations.

You can assign animation clips to the animation component and control playback from your script. The animation system in Unity is weight-based and supports Animation Blending, Additive animations, Animation Mixing, Layers and full control over all aspects of playback.

For an overview of animation scripting in Unity please read this introduction.

AnimationState can be used to change the layer of an animation, modify playback speed, and for direct control over blending and mixing.

Also Animation supports enumerators. Looping through all AnimationStates is performed like this:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Animation anim;

void Start() { anim = GetComponent<Animation>(); foreach (AnimationState state in anim) { state.speed = 0.5F; } } }

See Also: An overview of animation scripting in Unity is here.

변수

animatePhysicsWhen turned on, animations will be executed in the physics loop. This is only useful in conjunction with kinematic rigidbodies.
clipThe default animation.
cullingTypeControls culling of this Animation component.
isPlayingIs an animation currently being played?
localBoundsAABB of this Animation animation component in local space.
playAutomaticallyShould the default animation clip (the Animation.clip property) automatically start playing on startup?
this[string]Returns the animation state named name.
wrapModeHow should time beyond the playback range of the clip be treated?

Public 함수

AddClipAdds a clip to the animation with name newName.
BlendBlends the animation named animation towards targetWeight over the next time seconds.
CrossFadeFades the animation with name animation in over a period of time seconds and fades other animations out.
CrossFadeQueuedCross fades an animation after previous animations has finished playing.
GetClipCountGet the number of clips currently assigned to this animation.
IsPlayingIs the animation named name playing?
PlayPlays an animation without blending.
PlayQueuedPlays an animation after previous animations has finished playing.
RemoveClipRemove clip from the animation list.
RewindRewinds the animation named name.
SampleSamples animations at the current state.
StopStops all playing animations that were started with this Animation.

상속된 멤버

변수

enabledEnabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabledHas the Behaviour had active and enabled called?
gameObjectThe game object this component is attached to. A component is always attached to a game object.
tagThe tag of this game object.
transformThe Transform attached to this GameObject.
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public 함수

BroadcastMessageCalls the method named methodName on every MonoBehaviour in this game object or any of its children.
CompareTagIs this game object tagged with tag ?
GetComponentReturns the component of Type type if the game object has one attached, null if it doesn't.
GetComponentInChildrenReturns the component of Type type in the GameObject or any of its children using depth first search.
GetComponentInParentReturns the component of Type type in the GameObject or any of its parents.
GetComponentsReturns all components of Type type in the GameObject.
GetComponentsInChildrenReturns all components of Type type in the GameObject or any of its children.
GetComponentsInParentReturns all components of Type type in the GameObject or any of its parents.
SendMessageCalls the method named methodName on every MonoBehaviour in this game object.
SendMessageUpwardsCalls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the GameObject.

정적 함수

DestroyRemoves a gameobject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsOfTypeReturns a list of all active loaded objects of Type type.
InstantiateClones the object original and returns the clone.

연산자

boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961