【发布时间】:2023-01-03 12:58:00
【问题描述】:
我在尝试学习 C# 和 unity 进行游戏开发时遇到了这个错误。我试图将此 C# 脚本添加到预制件中:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PrintToConsole : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Debug.log("I'm printing to console");
}
// Update is called once per frame
void Update()
{
}
}
我最终在控制台中收到此错误:
Assets\PrintToConsole.cs(10,15):错误 CS0117:“调试”不 包含“日志”的定义
我很困惑为什么。
如果有帮助,这是我的 Unity 的屏幕截图。
我期待在我的统一平台的控制台中打印一条消息。
【问题讨论】:
标签: c# unity3d visual-studio-code