- Home /
Scripts don't execute at all.
I've been working on a project for a while now, and its all been going good. That changed a few days ago. All my previous scripts work fine, but any newly created scripts don't even start up. I've put it on a game object and I'm almost certain there aren't any mistakes. I even made a quick test script and attached it to an empty game object:
using UnityEngine;
public class Test : MonoBehaviour
{
private void Start()
{
Debug.Log("Start works");
}
private void Update()
{
Debug.Log("Update works");
}
}
Also, print("Start works"); doesn't work either.
I tried many things; re-importing all, going into different projects, and different versions of unity. Currently, I'm using 2019.1.5f1 personal.
Any tips would be greatly appreciated. Thanks!
Are you sure that you haven't any compiler error in your project? If any script has errors in it, Unity can't compile any of your code. All classes are compiled into a single assembly. If any of those source files has errors nothing will be recompiled.
ps: Also since you haven't mentioned it: Did you actually attach your script to a gameobject in the scene?
When I go into play mode, my console is empty.
Also, it is attached to an empty gameobject.
I also went into the editor log to see if I could find anything. I don't know if it helps, but I found this repeated line:
Update works
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
Test:Update() (at Assets\Scripts\LevelComponents\Test.cs:12)
(Filename: Assets/Scripts/LevelComponents/Test.cs Line: 12)
If the debug log appears in the log your script obviously is working. Are you sure you did not disable log messages in the console? Your screen shot only shows the laft half of the console window. At the right there are the 3 category buttons which can be enabled / disabled. $$anonymous$$aybe you messed around with the default logger, set a log filter or something similar.