Debug.Log Only Printing With Variable (Not string)
Hello, I'm experiencing an odd error that is either: a) so simple/stupid I'm overlooking it, or b) sign of a much deeper problem. When I use Debug.Log() some statements show in the console while others don't. It seems to be related to whether the string passed into Debug.Log() is preceded by a numerical variable.
I Tried new scenes, reinstalling Unity, etc. all with same behavior. Attached example scene. Can someone check this out to see if it reproduces on a different configuration? Thanks in advance.
Edit: Unity v2017.4.37f1 LTS, Windows
//Example
Debug.Log("hello"); // doesn't show
int x=0; Debug.Log(x+"hello"); // shows
// Function
public void T()
{
List<string> x = new List<string>();
x.Add("A");
x.Add("B");
x.Add("C");
int val = 0;
Debug.Log("items to process:"+x.Count);
bool test2 = false;
foreach(string s in x)
{
Debug.Log(s);
Debug.Log("start:"+test2.ToString()); // ignores
Debug.Log(s+": start - "+test2.ToString()); // works
if(test2==false)
{ Debug.Log("test is false");
val++; test2=true; }
else
{ Debug.Log("test is true");
test2=false; }
Debug.Log("end:"+test2);
}
Debug.Log("times set to true:"+val);
Debug.Log("------------------------------------");
}
Are you sure the Collapse
toggle is not active in your Console tab?
Hello. Yes, collapse isn't enabled. Since the messages are different strings i wouldn't expect them to be affected by collapse.
I've tested your T
function and I did not get any problem printing "start:"+test2.ToString()
Thanks for taking a look. Looks like I'll need to find some time to look into, and test, my install of unity. Will circle back if i find a solution. Thanks again.
Your answer
Follow this Question
Related Questions
Console Debug / Print do not show 2 Answers
Removing a Component that is a Nested Class. 0 Answers
Vertical Movement Is Wierd 1 Answer
I need help witha bug,Glitch While looking up 0 Answers
Android - Code working in Unity Remote but not in Build 2 Answers