Мои Уведомления
Привет, !
Мой Аккаунт Мои Финансы Мои Подписки Мои Настройки Выход
Руководство API скрипты

Объявление

public T[] GetBehaviours();

Описание

Возвращает все StateMachineBehaviour, соответствующие типу T или производные от T. Возвращает null, если ничего не найдено.

using UnityEngine; using System.Collections; // Пример StateMachineBehaviour. public class BreathBehaviour : StateMachineBehaviour { public bool fastBreath; // OnStateUpdate is called at each Update frame between OnStateEnter and OnStateExit callback override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { animator.SetBool("FastBreath", fastBreath); } } public class RunBehaviour : StateMachineBehaviour { // OnStateUpdate is called at each Update frame between OnStateEnter and OnStateExit callback override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { BreathBehaviour[] breathBehaviours = animator.GetBehaviours(); for (int i = 0; i < breathBehaviours.Length; i++) breathBehaviours[i].fastBreath = true; } }
Вы можете отблагодарить автора, за перевод документации на русский язык. ₽ Спасибо
API скрипты 2021.3