Help with RichTextLabel.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Syl


Got a RighTextLabel modified in every tiles of my Tilemap, and cleared when exiting them, with that little line of code:

func _on_Area2D_body_exited(_body):

It works fine, except when trying to change scene, then i got a crach, attempting to call function ‘clear’ in base ‘null instance’ on null instance…

And it’s an essential line of code, as much as my changing of scene… If anyone thinks of a workaround…
I’d need something like:

if change_scene = false:

But i don’t know how to write that in GDscript.

:bust_in_silhouette: Reply From: jgodfrey

Maybe this?

func _on_Area2D_body_exited(_body):
var node = get_node("/root/Node2D/Stage/Player/Text")
if is_instance_valid(node):

Exactly with this! Cheeeeeers! :slight_smile:

Syl | 2020-02-27 23:14