- Home /
Debug.Log is causing an Assert
Hi wondering if anybody can offer a clue about this... I'm using Debug.Log here and there in the code - and it's causing an Assert - Unity comes up with 'Assert in file ....' at the line of the Debug.Log ... removing the Debug.Logs and the game runs fine... the Debug.Logs can be very simple and still cause the assert - e.g.
UnityEngine.Debug.Log("triple Stuff this");
Yes, there are plenty of places where it is called without the UnityEngine. - same story...
Well Unity just says "Assert in file ... at line x" where x is the line with the Debug.Log call on it...
I am getting this too. I have a simple app with nothing in the scene except a camera and a plane. In my script I have nothing but
Debug.Log("ok");
and I get an assert exactly as the OP described.
Answer by _EdzUp_ · Jul 04, 2012 at 08:16 PM
Have you tried it without UnityEngine. on the from the docs http://docs.unity3d.com/Documentation/ScriptReference/Debug.Log.html give the command reference without calling UnityEngine. just the Debug.Log( "triple Stuff this");
That won't change anything. The use of UnityEngine is just redundant because it is already there with using UnityEngine
.
However, this is mandatory if you have another class called Debug in another assembly.
Answer by _EdzUp_ · Jul 10, 2012 at 10:01 AM
hmm, could it be some of your files have become corrupted? I have never heard of this problem before. If you could cobble together a simple example of where it goes wrong it would be a great help to diagnose and work out a fix for the problems.
Hmm that might be tricky... it's a pretty huge iPhone project that i'm converting over to unity.. it is up and compiling and running a bit... I'll see if i get the same problem on a small project on my machine (guess not...)
As a workaround, do you know of any other way i can get log messages out?
Hmm the way I would do it is write the logs to a file then when the app dies or crashes you can then look at the file to see where it got to when running last.