Godot: Weird error "get_node"

Created on 17 Dec 2019  ·  6Comments  ·  Source: godotengine/godot

Godot version:
3.2 beta3
OS/device including version:
win7-64
Issue description:
I have this error :Error 15,1: The method "get_node" isn't declared in the current class.
in this line:
onready var pos_spawn_enemy_mid:Vector2 = $Ground/SpawnPivots/EnemyMid.position

in terminal i have this error:


* daemon not running; starting now at tcp:5037
erasing C:\Users\homev3\AppData\Roaming/Godot/projects/topdown-656ff94ce70ac8286e098a1814b517d0/filesystem_update4
SCRIPT ERROR: GDScript::reload: Parse Error: The method "get_node" isn't declared in the current class.
          At: res://src/maps/Map.gd:15
ERROR: reload: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:576
* daemon started successfully
Running: C:\Users\homev3\Desktop\Godot_v3.2-beta3_win64.exe --path c:/Users/homev3/Documents/GoDot/release/projects/topdown
007 --allow_focus_steal_pid 19708 --position 1920,0
Godot Engine v3.2.beta3.official - https://godotengine.org
OpenGL ES 3.0 Renderer: GeForce GT 650M/PCIe/SSE2

ERROR: debug_get_stack_level_instance: Condition ' _debug_parse_err_line >= 0 ' is true. returned: __null
   At: modules/gdscript/gdscript_editor.cpp:338

in debug dock I have this error:

E 0:00:00.745   debug_get_stack_level_instance: Condition ' _debug_parse_err_line >= 0 ' is true. returned: __null
  <C++ Source>  modules/gdscript/gdscript_editor.cpp:338 @ debug_get_stack_level_instance()

But I have no idea if is related

Steps to reproduce:
I moved the $Ground
Minimal reproduction project:
NA

bug gdscript

All 6 comments

What class does Map.gd inherit from? get_node is a Node method. Most likely your class doesn't inherit Node or a derivate class.

@bojidar-bg @vnen Maybe we can make the error message clearer when $ is used in a non-Node class?

What class does Map.gd inherit from? get_node is a Node method. Most likely your class doesn't inherit Node or a derivate class.

@bojidar-bg @vnen Maybe we can make the error message clearer when $ is used in a non-Node class?

You right! I have nothing in first line but I had a extends Node2D before moving it

From my experience, this usually happens when inherited script has an error, so it can't be properly loaded.

I'm getting this currently with an inheritance depth of 3. Does inheritance just start to break down after a certain depth?

restarting the editor immediately took care of it... 🤷‍♂️

I just ran into the same issue. The class I was inheriting from was also called "Map" not sure if that has anything to do with it. As @MJBrune stated a restart of the editor did the trick.

Was this page helpful?
0 / 5 - 0 ratings