x


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");

more ▼

asked Jul 04 '12 at 03:25 PM

Triggly_Glix gravatar image

Triggly_Glix
150 2 4 8

Yes, there are plenty of places where it is called without the UnityEngine. - same story...

Jul 09 '12 at 08:07 PM Triggly_Glix

What does the assert say?

Jul 09 '12 at 08:15 PM whydoidoit

Well Unity just says "Assert in file ... at line x" where x is the line with the Debug.Log call on it...

Jul 10 '12 at 09:51 AM Triggly_Glix

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.

Aug 09 '12 at 04:10 PM benb

Where do you call the Debug.Log?

Aug 09 '12 at 04:14 PM Bunny83
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Jul 10 '12 at 10:01 AM

EdzUp[GD] gravatar image

EdzUp[GD]
53 1 3

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?

Jul 10 '12 at 10:51 AM Triggly_Glix

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.

Jul 10 '12 at 10:57 AM EdzUp[GD]
(comments are locked)
10|3000 characters needed characters left

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");

more ▼

answered Jul 04 '12 at 08:16 PM

EdzUp[GD] gravatar image

EdzUp[GD]
53 1 3

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.

Jul 04 '12 at 10:59 PM Kryptos
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x590
x239
x67
x35
x8

asked: Jul 04 '12 at 03:25 PM

Seen: 721 times

Last Updated: Aug 09 '12 at 04:14 PM