Version: 2018.2

Animation

class in UnityEngine

/

Inherits from:Behaviour

Switch to Manual

Description

Компонент Animation используется для воспроизведения анимации.

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.

Для обзора скриптинга анимации в Unity пожалуйста прочтите это введение.

AnimationState может использоваться для изменения слоя анимации, изменения скорости воспроизведения, а также для прямого контроля над смешиванием и перемешиванием.

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: Обзор скриптинга анимации в Unity here.

Variables

animatePhysicsКогда включено, анимации будут выполняться в физическом цикле. Это полезно только в сочетании с кинематическими физическими телами.
clipАнимация по-умолчанию.
cullingTypeКонтролирует отсечение данного компонента Animation.
isPlayingIs an animation currently being played?
localBoundsAABB of this Animation animation component in local space.
playAutomaticallyЕсли анимационный клип по умолчанию (Animation.clip) автоматически начинает проигрываться при старте.
this[string]Возвращает состояние анимации с именем name.
wrapModeHow should time beyond the playback range of the clip be treated?

Public Functions

AddClipДобавляет clip в анимацию с именем newName.
BlendСмешивает анимацию с именем animation в сторону targetWeight в течение следующих time секунд.
CrossFadeFades the animation with name animation in over a period of time seconds and fades other animations out.
CrossFadeQueuedПлавный переход анимации происходит после того, как предыдущие анимации закончат проигрываться.
GetClipCountПолучить количество анимационных клипов назначенных этой анимации.
IsPlayingПроигрывается ли анимация с именем name.
PlayPlays an animation without blending.
PlayQueuedВоспроизведет анимацию после того, как завершится воспроизведение предыдущих анимаций.
RemoveClipУдаляет анимационный клип из списка анимаций.
RewindПроигрывает анимацию с именем name.
SampleSamples animations at the current state.
StopОстанавливает все проигрываемые анимации, которые были запущены с этой анимацией.

Inherited members

Variables

enabledВключенное Поведение обновляется, выключенное Поведение не обновляется.
isActiveAndEnabledHas the Behaviour had enabled called.
gameObjectИгровой объект к которому прикреплён данный компонент. Компонент всегда прикреплён к игровому объекту.
tagТег данного игрового объекта.
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 Functions

BroadcastMessageВызывает метод названный methodName на каждом MonoBehaviour этого game object-а или любого из его потомков.
CompareTagПомечен ли данный игровой объект тегом tag?
GetComponentВозвращает компонент типа type, если он прикреплен к игровому объекту и null, если не прикреплен.
GetComponentInChildrenВозвращает компонент типа type в GameObject или некоторого его потомка через поиск в глубину.
GetComponentInParentВозвращает все компоненты типа type из GameObject'а или из любого его родителя.
GetComponentsВозвращает все компоненты типа type в GameObject.
GetComponentsInChildrenВозвращает все компоненты типа type в GameObject или любому из его потомков.
GetComponentsInParentВозвращает все компоненты типа type в GameObject или любому из его родителей.
SendMessageВызывает метод с названием methodName в каждом MonoBehaviour в этом игровом объекте.
SendMessageUpwardsВызывает метод с именем methodName в каждом MonoBehaviour в этом игровом объекте и в каждом предке поведения.
GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the GameObject.

Static Functions

DestroyУдаляет GameObject, Component или 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.

Operators

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.