- Home /
Stack Trace returns null ?? wtf with my unity today?
Here is my code:
using UnityEngine;
using System.Collections;
public class handler : MonoBehaviour {
private string stack;
private string message;
void Start()
{
Application.RegisterLogCallbackThreaded(LogHandler);
}
void OnGUI ()
{
GUILayout.BeginVertical("Box");
if (GUILayout.Button("Log something"))
{
Debug.LogError("Blablabla: "+Random.value.GetHashCode().ToString() + "\r\n");
}
GUILayout.TextArea(message + stack);
GUILayout.EndVertical();
}
void LogHandler(string Message, string Stack, LogType type)
{
stack = Stack;
message = Message;
}
}
The question is: Why in editor it works fine, but compiled version -> not. I mean that when i click play button in unityeditor, stack returned is not null:
But compiled:
Answer by Loius · Nov 20, 2012 at 05:36 PM
There's no reason for Debug statements to work in a release build. It's a release build. There's no situation in which an end-user should see your debug information.
If you want to circumvent this sanity check, you'll need to implement your own stack tracing - not difficult, just time-consuming. You'd have to tell it every time you enter a function (or write some kind of invasive sniffer to watch your code as it executes).
thanx for reply, I disabled unityplayer log, and try to make my log, which on error or bug on release will post Error and stack to log file, an user can make a bug report to forum, and in future releases from game, i need it cose the project at pre alfa stage, but i thing debug release will be not correct to post. hmm... will look at system diagnostick debug function =) thanx for reply
Answer by dpk · Nov 18, 2012 at 10:36 PM
Check the "development build" box in your Build Settings. Just be sure to clear that box before you build your shippable binary!
Answer by XienDev · Nov 19, 2012 at 07:18 AM
thanx for reply, but it's already cleaned, i made a simple project represents this bug (thing) from main project, any ideas ?:
Hmm.. but if development build is checked, than stack trace works fine =) ??? next question is: How to make release build shows stack trace?.
Your answer
Follow this Question
Related Questions
How can I fix the Unity Bug 1 Answer
Unity Editor lag 0 Answers
A node in a childnode? 1 Answer
Weird Point Lighting 1 Answer
DirectoryInfo().GetFiles works incorrectly in Standalone 2 Answers