![](/img/trans.png)
[英]Mixing UnityEngine.Debug and System.Diagnostics.Debug
[英]Ambiguous reference CS0104: 'Debug' is an ambiguous reference between'UnityEngine.Debug' and 'System.Diagnostics.Debug'
我是编程新手,需要帮助来修复错误弹出窗口,该弹出窗口出现在代码中编写 if 语句之后,所有 Debug.Log 行的 5 个错误代码,在 if 语句之前它们工作正常。
int max = 1000;
int min = 1;
Debug.Log("Welcome to number Wizard");
Debug.Log("Pick a number");
Debug.Log("Highest number is: " + max);
Debug.Log("Lowest number is: " + min);
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("Up Arrow key was pressed");
}
}
}
如果您不需要它在文件顶部,请删除
using System.Diagnostics;
否则,要么使用完整的命名空间
UnityEngine.Debug.Log("some text");
或添加
using Debug = UnityEngine.Debug;
在文件的顶部。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.