unity3d - Unity 脚本不继承可以管理脚本的原生类
问题描述
我刚刚在一个空白项目上打开了统一,我正在尝试将脚本链接到我的播放器对象(我正在使用资产商店中的某些东西)并且当我尝试连接它们时出现错误:脚本不继承可以管理脚本的本机类。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
我不明白为什么会这样说。
解决方案
确保脚本中的公共类名 与脚本文件名PlayerController
相同:.PlayerController.cs
这可能对你有用。
推荐阅读
- javascript - 全局变量未携带 Javascript FCF
- reactjs - 如何使用 React Router DOM 将 id 更改为 URL 的 slug
- android - 如何在 Google Play Store 上私下发布应用程序?
- laravel - 缺少路线 5.6 所需的参数
- angular - 从 API 中选择选项数据源
- java - 无法将 JSON 值反序列化为类型
- vba - 用于导出/复制粘贴到单独工作簿的 Excel 宏
- git - 使用 git merge / git merge-base,可靠地确定分支是否是功能分支
- laravel-5 - 在 Eloquent 中返回和访问 JSON 字段
- java - The minSdk version should not be declared in the android manifest file