My Godot Engine project crashed because of an infinite while loop (I did that on an accident because the condition was written wrong).
Now everytime I open my project and launch the game the console will be spammed with this error.
The error by itself is wrong (and the error wasn’t even present before my project crashed. not to mention the “infinite while loop” was in absolutely different script called level.gd).
When I close the game the console is still spammed with this error. I can’t do anything to stop it.
In task manager the game instance is closed. Clearing console does not help.
Without the code we could only guess.
The turret_buy.gdis trying to access the current_moneyand that is not available in the editor it seams. That’s what the Error is saying.
@tool
extends TextureButton
@onready var price_label : Label = $Label
@export var price : int = 70
func _process(_delta):
if Gameplay.current_money < price:
disabled = true
else:
disabled = false
canvas_layer.gd (it’s attached to CanvasLayer as an autoload with the name Gameplay
extends CanvasLayer
@onready var money_label : Label = $MarginContainer5/VBoxContainer/money/Label
@onready var gems_label : Label = $MarginContainer5/VBoxContainer/gems/Label
var current_money : int = 30
var current_gems : int = 0;
func _ready():
process_mode = Node.PROCESS_MODE_ALWAYS
func _process(_delta):
money_label.text = str(current_money)
gems_label.text = str(current_gems)
To be honest, I would mark your message as the solution. I decided to remove @tool from turret_buy.gd (because my current logic doesn’t need it right now) and error was fixed.