No output from print (icons all mark zero)

Godot Version

Godot Engine v4.2.1, Linux, OpenGL3

Question

Sorry I was looking for the newbie corner, if this is not the right place to ask this question let me know.

The print function is not outputting anything

I also tried to add a breakpoint on the print line as well; however nothing happened, it just ran without stopping at the breakpoint and the sprite is correctly showing on the screen. (no breakpoint on the screenshot, that was a straight F6)

PS: I have seen Print command not printing but this is different, all my icons are marking zero;

I just started learning and I’m following the getting started tutorial (currently at: Creating your first script — Godot Engine (stable) documentation in English) everything worked so far.

I think I got the same issue as you earlier last week :slight_smile: is your script attached to your scene?

in the hieararchy you should see this in the corner of your scene and this is what I was missing lat time I couldnt get any output from the debugger
image

1 Like

Thanks for the answer jahmmah!

Oh I see that icon in my “Sprite 2D” !
Also, when I right click on “scene1.tscn” and choose “Open Scene” it opens the script directly, so I think it’s attached? But I attached it to the “Sprite2D” I created like the tutorial says, I will try saving the “Sprite2D” as scene instead and see what happens!

1 Like

I just tried again with a new project and no comments in the file; I got the same result


(PS: I didn’t add the rendering on the screenshot this time but you can see it’s running on the top right corner)

for that perticular case I couldnt help 100%, maybe you clicked on the .gd file by accident instead of the tscn? this way, if your window mode is already in the script tab. that would explain why it opened up the script right away. but I banged my head an entire evening trying to understand why :stuck_out_tongue: now, I double check if my scripts are attached to my scenes :stuck_out_tongue:

can you show the scene inspector?

edit** nevermind its there :sweat_smile:

1 Like

Good point! I’ll make sure to keep that in mind and double check my scenes too!
my sprite2d says it’s attached to the script, when I hover the scroll icon it also says the correct name for the script

I can be interpreting this wrong, still getting my head around scenes and nodes

at this point unfortunately I am probably as much of a newb as you are! maybe its because it is on a sprite that is not in a scene? if you try parenting it to a node2D would that print?.. I’m 100% guessing with assumptions. btw :stuck_out_tongue: if it doesnt make sense I’d suggest to wait for someone who knows his sh*t because I dont hahaha… good luck!

edit unfortunately I just tried and I got a printed message … sorry I cannot help you more than that…

1 Like

oh! let me try that!

my first print encounter was pretty weird too, maybe it is a bug in the refresh state. if you found as a work around to re assign it, I’d do this for now but if you manage to repro the bug 100% with all the steps I guess it’d be nice to share it

1 Like

ok, I just tried two different ways

  1. with script attached to “Node 2D”
  2. with script attached to “Sprite 2D”

all yielded same results (no message)

Thanks for helping! I think it was good ideas to try anyway (I just totally clueless about what might be going on - I still don’t really understand how scenes and nodes affect each other :sweat_smile: )

agreed! (on sharing a bug report)

edit unfortunately I just tried and I got a printed message … sorry I cannot help you more than that…

this is making me wonder if it’s related to me running in compatibility mode; I will try getting my hands on another computer later that has a vulkan support to see how it goes!

Thanks for the help!

1 Like

yeah that specific aspect is a bit confusing… one day I woke up and it printed… no idea why… tonight, found that attach script thing was actually a thing so I guessed that was it but maybe it wasn’t! what looks weird and make me think it potentially something else is that you dont even have the basic lines
--- Debugging process started --- Godot Engine v4.2.1.stable.official.b09f793f5 - https://godotengine.org Vulkan API 1.3.277 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 4060 Laptop GPU

at the beginning making me think your engine is not even starting… but rest assured, so far that community is extremely helpful even to total newbs like ourselves :stuck_out_tongue: someone will try to help by tomorrow I’m almost 100% sure!

Thank you so much jahmmah! very appreciated!

1 Like

anyhow! good luck with that, I’ll follow the thread to know if you find the answer!

1 Like

You overriding a virtual function called _init().
_init() only runs when you instantiate a class via code.
Try your print statement in the _ready() function.

func _ready(): 
    print("test")

Thanks for the response sancho2! I’ve just tried with _ready - but the result is still the same. I wish it was at least throwing some kind of error message.

PS: also tried debugging with breakpoints on line 4 and 7 but it didn’t stop on either;

You should be getting some output when running the game. Did you change any setting from the editor settings or project settings?

Try running godot from a terminal with --verbose enabled and see if there’s output or not.

Click the “Project” menu → Project Settings → Application → Run

Look at the “Main Scene” property. Is it “res://sprite_2d.tscn” or something else?

Your first screenshot shows that clicked the “Run Project” :arrow_forward: button and not the “Run Current Scene” :clapper: button. So it’s possible the scene you expect to run is not the main scene of your game.

Thank you both for your help!

Now I actually see some messages, but not the output of the print:

Yes, It’s pointing to res://sprite_2d.tscn
PS: it doesn’t let me add two screenshots in one post so I’ll reply to this post with the relevant screenshot

I don’t know if relevant but my glxinfo shows:
OpenGL version string: 4.5 (Compatibility Profile) Mesa 24.0.3-arch1.2