Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | FortunePilot2 |
Hi, I’m having a very annoying problem that I just can’t seem to figure out.
I am trying to access a function in the script of a child using this line:
var save_info = get_node("World").save()
This line gives me the error: “Invalid call. Nonexistent function ‘save’ in base ‘Node’.”
This is my node structure:
Game (game.gd)
|_ World (world.gd)
My world.gd script:
class_name GameWorld
extends Node
func save():
var something = value
return something
Does anyone know what’s going wrong here?
Thanks in advance.
Also: Instead of get_node("World"),save()
can use $World.save()
or even better save world so can use it any time without doing a costly get_node
onready var _world := $World
rakkarage | 2020-10-13 14:59