#trying to get the path of a scene that's instantiated at runtime

1 messages · Page 1 of 1 (latest)

covert jackal
#

i'm making a multiplayer game where the player is spawned by a MultiplayerSpawner. i'm coding an enemy, and i need it to be able to reference the player.
the way my scene is structured, i have MultiplayerSpawner and Watcher (the enemy) both under Level, and Player is under MultiplayerSpawner. i'm trying to get the player with get_parent().get_node("MultiplayerSpawner/Player"), and it says it's a null instance. i screenshotted the code for the enemy and the multiplayer spawner. can you tell what i'm doing wrong?
(i know there's a MultiplayerScenes node there too, but i don't think it's being used. regardless, i tried replacing multiplayerspawner with multiplayerscenes and it still didn't work. i also tried uppercase and lowercase p in player.)

#

btw, i tried running in debug to make sure i know where the player is being instantiated, but it just wouldn't let me start a steam lobby ;w;

#

also, this code works for the player, which really makes me think i'm right about where the player is in the heiarchy

#

fixed! i really just didn't try the right combination

#

it was MultiplayerScenes/Player

#

i found it by doing print(get_path()) in the player