SharedBetweenAnimatorsAttribute
The SharedBetweenAnimatorsAttribute specifies that this StateMachineBehaviour is instantiated only once and shared by all Animator instances. This attribute reduces the memory footprint for each controller instance.
읽는 시간 3분최근 업데이트: 한 달 전
Definition
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.AnimationModule
- Inherits from: Attribute
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]public sealed class SharedBetweenAnimatorsAttribute : Attribute
Remarks
You choose which StateMachineBehaviour uses this attribute. If your StateMachineBehaviour changes a member variable, this affects all other Animator instances that use it. Additional Resources: StateMachineBehaviour class.
Examples
using UnityEngine;[SharedBetweenAnimators]public class AttackBehaviour : StateMachineBehaviour{ public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Debug.Log("OnStateEnter"); }}