Godot Version
4.2.2
Question
If I load/preload a Packed scene ( which has some custom boolean variable ), in a script, is it possible to interact with the variables of the packed scene, to check some conditions persay?
4.2.2
If I load/preload a Packed scene ( which has some custom boolean variable ), in a script, is it possible to interact with the variables of the packed scene, to check some conditions persay?
just threw this together and works well for me:
var enemy = preload("res://enemy.tscn")
func _ready():
var new_enemy = enemy.instantiate()
if new_enemy.enemy_type == "Knight":
print("enemy is knight")
new_enemy.health = 70
add_child(new_enemy)
print(new_enemy.health)
I see, thank you very much
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.