Can we retrieve in which instances "live" a variable ?
i have an ennemy with a Health variable:
extends Area2D var health : Health
and in my Health class code i would like to retrieve the ennemy instance where the health variable is "living"
extends Reference class_name Health func get_owner(): #how to get the ennemy that "own" this Health instance?
for the moment i can give the ennemy instance in Ennemy.gd like this:
extends Area2D. var health : Health func _ready(): health = Health.new() health.set_owner(self)
i was wondering if there was already a built-in method for Reference (or another class for this) that could retrieve the "owner" where the variable is "living" or if my method is the only way to retrieve the "owner"