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;
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 what’s happening
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
The problem seems to be that the compiler gets confused between the Deug() of the c# systems and the Debug() from unity engine, my code simply got fixed after I added {{{ UnityEngine. }}} example:
Unity is broken. Everytime you update it’s just a faff time and time again. It loses references, the build breaks, manifests need clearing, caches need removing then run time bugs on top of that as a result of all the breakages.
Absolutely tired of fixing projects that haven’t changed since the last time it was working. It’s like all you have to do to break a project is not load it for a week.
Here’s a quick fix that worked for me. I can’t guarantee that it will work for everyone with the same problem.
I had the same problem while using Visual Studio Code. All I did was restart it and the console was logging again. VSC wasn’t synchronizing with Unity Editor.
However, I lost all the recent changes I had made to the code. So be sure to first copy your code to it somewhere else.