新手求帮助,走路脚本总是显示Parameter 'Speed' does not exis
unity3d吧
全部回复
仅看楼主
level 1
金杰死了 楼主
这是我的代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
public float speed = 3;
Animator anim;
Vector3 move;
// Start is called before the first frame update
void Start()
{
anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
float x = Input.GetAxis("Horizontal");
float z = Input.GetAxis("Vertical");
Vector3 move = new Vector3(x, 0, z);
transform.LookAt(transform.position + new Vector3(x, 0, z));
transform.position += new Vector3(x, 0, z) * speed * Time.deltaTime;
UpdateAnim();
}
void UpdateAnim()
{
anim.SetFloat("speed", move.magnitude);
}
}
2023年02月16日 11点02分 1
level 12
试看anim.SetFloat(speed, move.magnitude);?
2023年02月16日 20点02分 2
"speed"和speed是不同的
2023年02月18日 03点02分
level 7
动画状态机里的speed参数你没设置
2023年02月17日 04点02分 3
level 8
动画控制器里面没有这个参数
2023年02月17日 06点02分 4
1