Assets\Scripts\DisplayLog.cs(7,12): error CS0246: The type or namespace name 'LogText' could not be found (are you missing a using directive or an assembly reference?)
还原错误环境的demo,unity项目文件:
链接:https://pan.baidu.com/s/1M3CQSnWymv0d7tcnoyqIMQ
提取码:yrzf
public class LogText
{
public string log = "一个日志内容";
}
using UnityEngine;
public class DisplayLog : MonoBehaviour
{
public LogText LogText;
// Start is called before the first frame update
void Start()
{
LogText = new LogText();
Debug.Log(LogText.log);
}
}
Assets\Scripts\DisplayLog.cs(5,12): error CS0246: The type or namespace name 'LogText' could not be found (are you missing a using directive or an assembly reference?)
在不删除Scripts.asmdef,不能给LogText.cs 增加 .asmdef 程序集的情况下,让Scripts类可以引用到LogText 的内容,期望得到大家的帮助。
还原错误环境的demo,unity项目文件:
链接:https://pan.baidu.com/s/1M3CQSnWymv0d7tcnoyqIMQ
提取码:yrzf
请以该demo为错误场景帮忙解决问题,并贴出解决问题后的代码。
万分感谢
这里的方法有试过吗
https://blog.csdn.net/yexiaomodemo/article/details/119238320