All Questions


Craig Ostrin

Isn't assert only for debug purposes?

The GDScript docs say the code within assert() only runs in the editor or debug mode. Why use it here?

func set_is_selected(value) -> void:
    if value:
  • Nathan Lovato replied

    It's so you don't write any code that violates this rule during development: you should only set a battler to selected if it is selectable.

    As you should test your game in debug mode, the assert will give you an error if you were to set is_selected to true when you shouldn't.