首页 > 解决方案 > 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?)

标签: c#unity3d

解决方案


问题出在这个属性上:

public dataClass data { get; set; }

编译器不知道任何具有该部分名称的类。


推荐阅读