Unity 6.3
0 онлайн 40 гостей 3 в системе
Вход

Animator.speed

Declaration

public float speed;

Описание

Скорость воспроизведения Animator. 1 является обычной скоростью воспроизведения.

Используйте Animator.speed для изменения скорости воспроизведения Animator. Любая анимация, воспроизводимая Animator, замедляется или ускоряется в зависимости от изменения скорости. Установите скорость в 1 для нормального воспроизведения. Отрицательная скорость воспроизведения поддерживается только при включенной записи. Для более подробной информации см. Animator.recorderMode.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Example : MonoBehaviour { Animator m_Animator; //Value from the slider, and it converts to speed level float m_MySliderValue;

void Start() { //Get the animator, attached to the GameObject you are intending to animate. m_Animator = gameObject.GetComponent<Animator>(); }

void OnGUI() { //Create a Label in Game view for the Slider GUI.Label(new Rect(0, 25, 40, 60), "Speed"); //Create a horizontal Slider to control the speed of the Animator. Drag the slider to 1 for normal speed.

m_MySliderValue = GUI.HorizontalSlider(new Rect(45, 25, 200, 60), m_MySliderValue, 0.0F, 1.0F); //Make the speed of the Animator match the Slider value m_Animator.speed = m_MySliderValue; } }