私のキャラクターをanimation
で歩いて、もう1人はanimation
のままにしています。以下の図に示すようにControlesの変数animacaoが割り当てられていません
はAnimator
で、Iはアニメーション間の交換の制御を行うタイプfloat
andarのパラメータを作成しました。
そして
* andar> 0.1 = personagem。
* andar < 0.1 = personagemStop;
矢印の一つの例:
私のjavascriptのコード:
#pragma strict
var speed : float;
var personagem : GameObject;
var animacao : Animator;
function Start() {
speed = 2;
}
function Update() {
transform.position.x += Input.GetAxis("Horizontal") * speed * Time.deltaTime;
//THE ERROR OCCURS IN "andar"!!!!!_________________________________________
animacao.SetFloat("andar",Mathf.Abs(Input.GetAxis("Horizontal")));
//________________________________________________________________
if(Input.GetAxis("Horizontal") < 0){
personagem.gameObject.transform.eulerAngles = Vector2(0,180);
}
else if(Input.GetAxis("Horizontal") > 0){
personagem.gameObject.transform.eulerAngles = Vector2(0,0);
}
}
多分それは、Unityバージョン
に関連したものになるかもしれません私はこのチュートリアルに従っていました。
https://www.youtube.com/watch?v=PDuqGIB8j7E
マイUnityバージョン= 5.3.1f1
ユニティチュートリアルバージョン= 4.3.2f1
エラー:答えは簡単です
UnassignedReferenceException: The variable animacao of Controles has not been assigned. You probably need to assign the animacao variable of the Controles script in the inspector. UnityEngine.Animator.SetFloat (System.String name, Single value) Controles.Update() (at Assets/Assets/Scripts/Controles.js:17)
ありがとう、私は今夜テストし、あなたに警告します。 – CristianCotrena