简单登录unity C#脚本 [英] Simple log in unity c# script
问题描述
这应该很简单,但仍然找不到直接的答案:
It should be simple, but still can't find a straight answer:
如何使用C#Unity脚本记录简单消息?
How can I log a simple message using C# Unity script?
我尝试过:
Debug.Log("Hello Log");
它不起作用,或者我没有在正确的位置看
It doesn't work or I'm not looking at the right place.
推荐答案
Debug.Log("Hello Log");
可以在控制台选项卡上找到.
让您能够看到它:
1 .您必须将其放入脚本的函数中.
1.You must put it in a function from a script.
public class Test : MonoBehaviour
{
void Start()
{
Debug.Log("Hello Log");
}
}
2 .脚本必须附加到GameObject.
2.Script must be attached to a GameObject.
3 .必须启用脚本及其所附的GameObject.
3.Both the script and the GameObject it is attached to must be enabled.
4 .如果看不到控制台选项卡,请重置版式.
4.Reset the Layout if you can't see the Console tab.
我在Android设备上对其进行了测试.这就是为什么我没有看到它.
I tested it on Android Device. That's why I didn't see it.
在这种情况下,请使用Android Studio中的Android Monitor来查看Android设备中的日志.
In that case, use Android Monitor from Android Studio to view the log from your Android device.
这篇关于简单登录unity C#脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!