#How do i `@export` a variable to scene root node, so its available when using scene in a scene (like

2 messages · Page 1 of 1 (latest)

red pawn
#

What i mean by that, lets say i have scene:

TestScene.tscn
  Player - this is CharacterBody2D saved as scene (Player.tscn)
Player.tscn
  Stats - Node with script bellow
# script attached to Player.tscn/Stats node
extends Node
@export var health: float = 100.0

When i use Player.tscn inside TestScene.tscn i would like to see in the in inspector then health value, but that is only possible if i attach the script to CharacterBody2D. How can i have multiple scripts that all export to root node of the scene (in this case Player.tscn)?

sharp igloo
#

Right click parent of Player, select Editable children
Click the new yellow node
You can now change its export variables