incorporate variable into spawned scene identifying spawning node

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

How do I incorporate the body.name of the node of a scene that spawns another scene, into a variable in the spawned scene?

Thanks.

:bust_in_silhouette: Reply From: noob51beta

var lion_scene = load (“res://a_lioness/newlion15_nb.tscn”)
var lion_instance = lion_scene.instance()
get_parent().add_child(lion_instance)
path_to_node = (lion_instance.get_path())
get_node(path_to_node).mother = self

edit: underscores have been stripped out after I post and things put in italics. get underscore parent, add underscore child, get underscore path, get underscore node.

Above works in my project. I orientate the spawned kinematic body toward the variable “mother” - why I needed something to identify the spawning node by. It appears I did not need the body.name. A KinematicBody:number works :slight_smile: