Hello everyone I have a very simple question about Debug.Log(). how can I get Unitys console to only show the variable once instead of the log looping. I want to use a non static variable if possible.
place it in `Start()` or `Awake()` function instead of Update. So you get something like:
var mySpecialVar;
function Start() {
Debug.Log("Only once i want to show you my: " + mySpecialVar);
}
If you have to call it in function Update, if you can call it in the first frame, you could do something like
var debugged : boolean = false;
function Update ()
{
if (!debugged)
{
Debug.Log("My Debug Output");
debugged = true;
}
}
(This would have the additional merit that you could just set debugged = true when you're finally building the thing, as Debug can be a performance-drag)
If you need it in a later frame, after some event, you'd have to fiddle a bit with where you set the debugged-variable, but basically this should do the trick...?
Greetz, Ky.