Unity 不会执行脚本
Unity won't execute script
这是我的超级简单的unity脚本:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class script : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Debug.Log("Something");
}
// Update is called once per frame
void Update()
{
}
}
我将脚本附加到主相机:
我运行unity游戏后,控制台是empty
,也就是说脚本不会运行。
这只是我创建的一个新项目来测试它,因为在我原来的项目中,unity 自发地停止执行脚本。我卸载了旧版本 (2019) 并安装了新版本 (2020) 以及 Visual Studio(即使没有必要),但没有任何区别。
您提供的代码似乎工作正常。您的控制台 window 为空的一个潜在原因可能是搜索字段中有内容或禁用了标准日志。
这是我的超级简单的unity脚本:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class script : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Debug.Log("Something");
}
// Update is called once per frame
void Update()
{
}
}
我将脚本附加到主相机:
我运行unity游戏后,控制台是empty
,也就是说脚本不会运行。
这只是我创建的一个新项目来测试它,因为在我原来的项目中,unity 自发地停止执行脚本。我卸载了旧版本 (2019) 并安装了新版本 (2020) 以及 Visual Studio(即使没有必要),但没有任何区别。
您提供的代码似乎工作正常。您的控制台 window 为空的一个潜在原因可能是搜索字段中有内容或禁用了标准日志。