Getting a scene to display different texts.

Godot Version

4.4

Question

Hello!
I am trying to learn Godot by making a basic plattforming game and bumped in to a problem I was hoping to get help with. I have made i "sign"scene consisting of a basic sprite, an Area2d and a label. When the player character enters the Area2d the labels text becomes visible.

It works as intended however throughout the level I want to place many different signs with different texts. One way would be to make a lot of different signs with different labels but I wondered if there is a smart way to use the same scene but make it display a different message depending on where it i placed. Is there a way to achieve this?

You can use an @export variable to change the property from the editor.

Assuming your Sprite, Area2D, or a Node2D is the root of your scene you could use something like this; and edit the new property on the level’s signs.

@export_multiline var signpost_text: String 

func _ready() -> void:
    $Label.text = signpost_text

Thank you! I will start by using the export function