Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can't print to console in Godot 4 C#

I create a new project, add a root Node2D called ‘Level’ and attach a script:

using Godot;
using System;

public partial class Level : Node2D
{
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        Console.WriteLine("hello");
    }

    // Called every frame. 'delta' is the elapsed time since the previous frame.
    public override void _Process(double delta)
    {
    }
}

After running the game, nothing appears in the output:
screenshot of output (I do have all the output types enabled)

When I try throwing an exception from the function:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

public override void _Ready()
{
    Console.WriteLine("hello");
    throw new Exception("test");
}

Then we do see the error.
sc of output

What am I missing here? Thanks in advance.

>Solution :

using static Godot.GD;

public class Test
{
    static Test()
    {
        Print("Hello"); // Instead of GD.Print("Hello");
    }
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading