- Home /
Console not outputting from Debug.Log()
I'm trying to Debug my code to see how far it makes it, but i'm not getting any response from my Debug.Log()
functions, here is my code:
using UnityEngine;
using System.Collections;
public class numberOfTaps : MonoBehaviour
{
float timer;
// Update is called once per frame
private int tapCounter = 0;
void Update ()
{
Debug.Log ("Hello"); //It doesn't even print this?
int number = Random.Range(50, 250);
Debug.Log (number);
for (int i = 0; i < Input.touchCount; ++i)
{
if (Input.GetTouch(i).phase == TouchPhase.Began)
{
if(Input.GetTouch(i).tapCount == 1)
{
tapCounter += 1;
}
}
}
Debug.Log (tapCounter);
if(tapCounter == number)
{
renderer.material.color = Color.red;
}
}
}
As you can see, my first "Hello" doesn't even get displayed on the console, now i am quite tired but I cant seem to see anything wrong, maybe a few sets of eyes can point out a reason for this?
EDIT: I've now taken all code except for the Debug.Log("Hello");
and I'm still getting nothing, not sure whats happening
Answer by JayFitz91 · Jul 27, 2014 at 04:23 PM
I seem to have solved the problem by deleting the scene and script attached to the object and creating new ones, I used the exact same code in my script and it worked, don't know what caused it
I had the same problem with a script that would only output some print() and not all of them, some functions did not work correctly either. A copy/paste inside a new file (with the exact same code) solved the problems. It confuses me...
I had the same issue with my script that would only output Debug.Log("Hey World");
it's doesn't work but it's work after creating a new Script and paste the same code in it.
Answer by MrSteve1 · Jul 27, 2014 at 03:44 PM
Check to see if that particular output has been enabled in the console.
You can hide certain types of messages.
Se below
I'm not seeing that in my console, just three 0's up there when i press play, nothing happens at all
check if its clicked so it will be displayed, not the counter.
No I'm still getting nothing, I've removed all other code except the Debug.Log("Hello") and even that's not working. I'm going to remove the scene and script and re-do it as i've loaded up another scene where i have a counter and it's working fine
That seemed to do it, i used the exact same code but in a different scene/script and everything works ok now, don't know what caused that
Sometimes you can only see the buttons if you move the console and make it bigger.
Answer by syahmicro · Aug 05, 2016 at 10:52 AM
i just fixed the problem..
step 1 : ctrl + shift + c step 2 : enable/click on 3 icons at right console as picture below:
Thank you, Your Comment was helpful , I wish i knew what Ctrl+Shift+C did to unity
Answer by Tralfazy · Jul 11, 2017 at 01:20 AM
Debug.Log not showing.. Remove Component (script name), Add Component (script name) fixed it for me. Didn't need to delete scene.
Thanks, this did it for me. This kind of bug really throws one off.
Answer by unity_epO43A6p7BZ8dQ · May 17, 2019 at 08:08 AM
@MonolithTyriss @JayFitz91 Try the suggestions from this link: https://forum.unity.com/threads/no-output-from-debug-log.498106/,@MonolithTyriss @JayFitz91 try this: https://forum.unity.com/threads/no-output-from-debug-log.498106/
Your answer
Follow this Question
Related Questions
5.4 Debug Console won't open Debug.Log on double click 3 Answers
Is there a way to make Console events write to the web browser's console? 3 Answers
How to access compiler warnings to i.e. output them to custom console? 1 Answer
Can I change the destination of selecting console entries 0 Answers
Unity Console not showing result 1 Answer