Hi all, I've been playing with Godot for the past few days by following a youtube tutorial by ClearCode for a 2D top down shooter. Everything has been going well until this afternoon when I had a problem I just don't understand. when I try and run my project all I get is the Godot splash, and if I close it and try again I don't even get that, just a static image of the editor in the debug window. In both cases the window can only be closed by clicking stop in the editor. The problem is that I'm not getting any errors reported by Godot, so I'm finding it hard to troubleshoot. The only thing I think I did since the project worked was to change the collision shape on a CharacterBody2D, now nothing I can think of trying gets it working again.
Some details:
I am running Godot (4.1.3.stable.official.f06b6836a) through steam on Manjaro linux. I have verified files through steam & I have tried downloading Godot through Manjaro's package manager and running via a terminal, but still no reported errors. I have tried a different project that had from following another tutorial which seems to work fine.
I'm keeping my fingers crossed that someone here can suggest something to try 'cos I'm at a loss.
Thanks for reading, and let me know if there's any further details I can supply.
Project suddenly outputs a blank debug screen with no reported errors.
- Edited
OK, solved it.
So I was originally having issues with "navigationserver map query failed because it was made before first map synchronization" error when setting up a NavigationRegion/Agent2D. The tutorial suggested this might happen & to use call_deferred as a solution, but I was unsure of the exact syntax. An internet search came up with the suggestion to use:
func _ready():
. set_physics_process(false)
. call_deferred("nav_map_setup")
func nav_map_setup():
. await get_tree().physics_frame
. set_physics_process(true)
This was definitely working for a while as I ran the project a few times while getting the character to face forwards while following the path. I Then found it was sometimes getting stuck on walls, so tried changing the shape of the collider which somehow got me to the issue I posted above. I am now using:
var first_physics_frame : bool = false
func _physics_process(_delta):
. if ! first_physics_frame:
.. await get_tree().physics_frame
.. first_physics_frame = true
Seems to be working for now at least! If anyone understands why the first solution stopped working for me, or knows of a better solution than the one I'm currently using, I would really appreciate you letting me know.
Sorry about the poor formatting of the code, had to use '.' to indent.