#Using _get_configuration_warnings to display configuration errors.

1 messages · Page 1 of 1 (latest)

gentle valley
#

Hello, I'm writing a simple spawner (a Node with a child Timer), and I want to display an error when the user hasn't provided the entity to spawn. I have written up a _get_configuration_warnings function (see below), but it doesn't have any effect. I want it to give a warning similar to CharacterBody2D.

The spawner is not a @tool, because its a gameplay element, not an editor script.

@export var to_spawn: PackedScene :
    set(value):
        to_spawn = value;
        update_configuration_warnings();

func _get_configuration_warnings() -> PackedStringArray:
    var ret = [];
        
    if not to_spawn:
        ret.append("Entity to spawn required.")
    
    return ret;

func _on_timer_timeout() -> void:
  # game logic
open vessel
gentle valley
#

How would I apply that then? Do I need to wrap all the gameplay logic in "if not Engine.is_editor_hint():" ?

open vessel
rose coral
#

Probably better to do if Engine.is_editor_hint(): return

#

So that all your logic isn't indented