c# - Unity:定义一个新类新类
问题描述
在给定的类下面,我想在提供的类下面创建一个新类,但它给出了错误。
public class apicall : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
public class responseData
{
public string status { get; set; }
public dataClass data { get; set; }
}
错误:
Assets/apicall.cs(39,10): error CS0246: The type or namespace name 'dataClass' could not be found (are you missing a using directive or an assembly reference?)
解决方案
问题出在这个属性上:
public dataClass data { get; set; }
编译器不知道任何具有该部分名称的类。
推荐阅读
- python - 如何在类定义中调用类函数?
- python - 堆积散点图
- javascript - Slickgrid:删除列文本
- python - 将 pcap 文件转换为重新组装的流(json)
- c++ - 我在使用 getline 时遇到问题
- python - 如何将视频从我的 Kivy android 应用程序流式传输到处理数据的服务器?
- ruby - 有没有办法可以在 ruby 中调用另一个类的方法?
- python - 如何使实体在pygame中因颜色碰撞而受到伤害?
- php - Microsoft 从 PHP 8 起终止对 PHP 的支持
- javascript - 如何将 32 位整数集合中的随机整数存储在紧凑的数据结构中以快速检查成员资格?