1
基於此Unity Animator API,有一個名爲IsInTransition的公共函數。但爲什麼我不能使用它?動畫師不包含「IsInTransition」
當我嘗試在MonoDevelop中到代碼中,自動完成不會工作,並建立了錯誤:
Assets/Scripts/CatAnimator.cs(32,18): error CS1061:
Type `Animator' does not contain a definition for `isInTransition'
and no extension method `isInTransition'
of type `Animator' could be found.
Are you missing an assembly reference?
什麼想法?
的完整代碼:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Animator : MonoBehaviour {
Animator myAnimator;
public float speed = 10.0f;
public float jumpSpeed = 8.0f;
public float gravity = 20.0f;
private Vector3 moveDirection = Vector3.zero;
CharacterController controller;
float currSpeed, Param1;
bool Param2, Param3;
// Use this for initialization
void Start() {
controller = GetComponent<CharacterController>();
myAnimator = GetComponent<Animator>();
}
// Update is called once per frame
void Update() {
Param1 = 0;
Param2 = false;
Param3 = false;
if (controller.isGrounded) {
//==
}
if (myAnimator.IsInTransition (0)) { //ERROR HERE...
}
}//==update
}//==class
但是最新的代碼? – Hristo
@Hristo等一下,我會加上 – anunixercoder
它在Unity手冊中說:'IAnimatorControllerPlayable.IsInTransition'。還有它說:_實驗:這個API是實驗性的,可能會在將來更改或刪除。 – Hristo