I'm starting to code with c# (yay!) and I tried using a debug.log command, but unity gives me two errors: Assets/Variables.cs(12,19): error CS0117: `UnityEngine.Debug' does not contain a definition for `log' and Assets/Variables.cs(16,13): error CS0103: The name `debug' does not exist in the current context Here is my coding. I'm using visual studio 2015 to code. using UnityEngine; using System.Collections; public class Variables : MonoBehaviour { public bool Alive = true; // Use this for initialization void Start() { if (Alive == true) { Debug.log("You are alive!"); } else { debug.log("You are not alive."); } } // Update is called once per frame void Update () { } } Thanks!!
And also, in you else statement : Debug.Log() What IDE are you using? Visual Studio has a pretty usefull code completion that avoids this kind of errors.
Woah, it works! Thanks! I guess I've been writing HTML for too long, where it's not case sensitive. I admit, I have no idea what an IDE is.
IDE meands Integrated Development Environment. Visual Studio, Mono, Eclipse...just to name a few of them, are IDE. So my question was : in what kind of software are you writting your scripts?
Ok. When you type a method name, you can press Ctrl+space bar to have the code completion. That will help avoiding case sensitive issues. Code completion is the best tool for programming. But by default, VS 2015 should pop up this window automatically.