![](/img/trans.png)
[英]error CS0246: The type or namespace name 'IApplicationBuilderExtensions' could not be found
[英]error CS0246: The type or namespace name 'PlayerMotor' could not be found
我正在制作我的第一个游戏,这个错误出现了我不知道我是否可以使用“使用”标签来解决这个问题,我不知道是哪个
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(PlayerMotor))]
public class PlayerController : MonoBehaviour
{
public LayerMask ourMovmentMask;
Camera cam;
PlayerMotor motor;
// Start is called before the first frame update
void Start()
{
cam = Camera.main;
motor = GetComponent<PlayerMotor>();
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0))
{
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, 100, ourMovmentMask))
{
Debug.Log("we hit " + hit.collider.name + " " + hit.point);
// move player to what we hit
// stop focusing any objects
}
}
}
}
您需要游戏对象具有“PlayerMotor”组件。
您是否定义了 PlayerMotor 类? 如果没有则定义它,因为编译器找不到该类。
如果是,则检查它是否在您的项目目录中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.