我遵循youtube的统一练习,似乎在6:42遇到问题。
这是链接:https://www.youtube.com/watch?v=gE7gc1sblUA/
和屏幕截图:
和脚本:
using UnityEngine;
public class player : MonoBehaviour {
public float jumpforce = 10f;
public rigidbody2D rb;
// Update is called once per frame
void Update() {
if (input.GetButtonDown("Jump") || Input.GetMouseButtonDown(0))
{
rb.velocity = Vector2.up * jumpforce;
}
}
}
我该如何解决?