Compiler error with Debug.log

Hi !
Just starting with the course, i got to the part where we’re supposed to output a simple text in the console using debug.log

First time doing Unity, and second time using C# but i’m familiar with other programming languages (Java, Javascript, Python mainly)

Here is my code (super simple, and should be the same as in the course) :

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PrintToConsole : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        Debug.log("I'm printing to the console "); 
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

Now the issue is that Unity is angry at me, saying “‘Debug’ does not contain a definition for ‘log’”

After searching a bit i found people experienced the same problem because of a scope issue (even though having “using UnityEngine”), so tried UnityEngine.Debug.log but it doesn’t work either.
I’m aware it could be because i may have a class named Debug somewhere but it’s literrally the only class in the project as of now and i didn’t download any assets or stuff like that

Did i miss something setting up Unity or VSCode perhaps ?

Nevermind i found it, it’s Debug.Log not Debug.log. Not used to C# defining everything with capital letters

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms