0 votes

Currently in final stages of development using 2.1.

I have a button in my main menu that quits the game but the game crashes when I click it. It only happens in my exported game (Windows Desktop).

I have a simple function in my main node for quitting the game:

func mainQuit():

In the debug window the errors are:
enter image description here

Can anyone please explain how to fix this?

in Engine by (61 points)

I have first 2 error messages in 3.0.2, no crash.
Try using call_deferred(), maybe.

Two things worth checking.

First you can see if you have leaks. Using a Debug build (which looks like what you're doing already), from the command prompt you use the -v flag. C:\Exported Game Folder> "my game.exe" -v

It will show all the resources loading when it opens.

When it closes it may report resources that haven't been freed.

The second possibility is a bug with ColorN(). Search your code for the use of ColorN() and try replacing them.

I had an issue where if you use these in the highest scope of a GDScript, they have some sort of bug/leak in the backend that hangs up the quit().

extends Node2D

var my_color = ColorN("white") # Change these to Color(1,1,1), etc.

func _ready():

This is an issue I found in 2.1: https://github.com/godotengine/godot/issues/18216

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.