Hello. I’m working on a simple script using Debug.Log and everything seems to be right, but nothing appears in the editor console when I press play. My code is:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LearningScript : MonoBehaviour {
public int myNumber = 9;
// Use this for initialization
void Start () {
Debug.Log(2 + 9);
Debug.Log(11 + myNumber);
}
// Update is called once per frame
void Update () {
}
}
Thanks, Jeff! I’m following along with Learning C# by Developing Games with Unity 5.x so I’ll be sure to let the author know about this. Incidentally, what can I use to print numbers to the console?
It’s old question though… still if anyone else faces same problem make sure the gameobject you have attached your script is active. This is the most possible reason.
Otherwise, make sure the function you have your log statement in is being called, and if it is, then make sure any conditional logic around the log statement is true.