- Home /
Why wouldn't Debug.Log show up in Start or Awake ?
The question says it all.
I'm trying to debug a program and I have a Debug.Log in Start and one in Awake and neither is firing for some reason.
Hmmmm.
void Awake ()
{
Debug.Log ("Am I awake ???");
for (int i = 0; i < 3; i++) {
CreateAlly();
}
}
void Start(){
Debug.Log ("This is the start area !!!");
}
Is the script attached to an object; and, if so, is there any error before the functions are called?
Either this script is not attached to a game object in the scene, or the game object that it is attached to is disabled, or you have disabled logging in the console (check the top right of the console window for 3 buttons, one with a ! in a speech bubble, another with a ! in a triangle, and a third with a ! in a octagon. $$anonymous$$ake sure they are all enabled)
Thanks. I'm trying to figure this out. I appreciate your help.
I've clicked those buttons (speech bubble, triangle, octagon)...and I've clicked them and I've clicked them...I've tried every combination of those. No cigar there.
The script is attached to an object...odd thing though, whenever I add an "empty" object and attach the script to that, the unity program totally freezes and I am forced to stop it by Ctrl-Alt-Del...I've added scripts to empty objects before and I've never had Unity freeze from that before.
I never "disabled" the objects...at least I don't think so...in fact, I'm not even sure how to do that. I'll try to find something in the manual about that to see if that could be the culprit though.
Have you tried the script in a new empty scene? Are you able to post the entire code?
Answer by DonutVendor · Aug 30, 2017 at 05:52 PM
Make sure you have debug messages set to show up in your console
I really don't know what it was but I have it working. I reloaded Unity and re-coded my program (which wasn't long anyway) and did some other stuff.
It works fine.
Again, I really don't know what it was but I'll give your credit because you were probably right.
Thanks.
Answer by ooblii · Aug 30, 2017 at 01:01 AM
The only way I can see this happening is if the script is not attached to a gameObject in the scene.
Indeed. Except that it IS attached to a gameObject...in fact, I've put it on and taken it off a number of items to see if that might be the culprit.
I've tried rebooting and restarting and recoding and all that.
I'm having a number of other problems as well. I guess I could remove and re-load Unity and see if that works. I'm stumped here.
...and thanks, by the way, I appreciate your response. I know it's sort of a nebulous problem...I think I'm just going to reload Unity and see if that works.
did you try the second part to bobisgod234's answer? Could you have possibly disabled logging?
Answer by Topthink · Aug 30, 2017 at 07:51 PM
I got to the point where the unity program was crashing almost every time I tried to run it to check for a debug message. And when it didn't crash, it was freezing/locking up and I couldn't do anything after that. I started writing a new program and got a message that the "bake" was paused while the program was running. Hmmmm. I hadn't baked anything yet...terrain or otherwise.
I must have corrupted the program/engine somehow...could be my electric personality. :)
I really don't know what it was but I deleted Unity, and reloaded it. And now it seems fine.
I appreciate those who took the time to assist me and I apologize that you had to take time for something that was probably my fault to begin with.
Thank you.
Baking is referring to Unity's Global Illu$$anonymous$$ation baking. Auto baking is enabled by default, and as such even in a blank scene you will see that, it is normal.
You can disable Auto Baking by going to Window -> Lighting -> Settings and at the bottom right of that window, unticking "Auto Generate".