unity大佬请帮我看看代码有什么问题?可以运行的,可是 ...
using System.Collections;using System.Collections.Generic;
using UnityEngine.EventSystems;
using UnityEngine;
using Unity.VisualScripting;
using System;
public class Playcontrol : MonoBehaviour, IPointerClickHandler
{
public float forcenub;
Rigidbody rb;
public void OnPointerClick(PointerEventData eventData)
{
switch (eventData.button)
{
case PointerEventData.InputButton.Right:
Update();
{
float hInput = 0;
hInput = Input.GetAxis("Horizontal");
float vInput = 0;
vInput = Input.GetAxis("Vertical");
rb.AddForce(new Vector3(hInput, 0, vInput).normalized * forcenub);
}
break;
}
// Start is called before the first frame update
void Start()
{
rb = GetComponent();
}
// Update is called once per frame
}
private void Update()
{
throw new NotImplementedException();
}
} update是生命周期函数,每帧都会执行的,里面有抛出异常的代码,相当于每帧抛出一次 你还没实现Update方法呢,那里面一直在throw exception
页:
[1]