Position2D in Godot 4: it is Marker2D now
By Eduardo Orellana · Updated
Position2D is called Marker2D in Godot 4, and Position3D is Marker3D. In a Godot 4 project, Position2D.new() fails to parse with Identifier "Position2D" not declared in the current scope. Did you mean to use "Marker2D"?.
AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.
Intel or AMD Chromebook, with Linux turned on.
What Godot is checking
GDScript resolves every name when the script loads. Position2D is not a class in Godot 4, so the analyzer stops before anything runs, and because the name is in Godot's own table of Godot 3 renames, the message names the replacement.
The converter carries Position2D to Marker2D and Position3D to Marker3D. It is still a Node2D that draws a cross in the editor and nothing in the game, used for spawn points and muzzle positions; gizmo_extents sets the size of the cross.
Reproduce it
A Godot 3 script that creates a Position2D in code, in a Godot 4 project.
extends Node
func _ready():
var spawn = Position2D.new()
print(spawn)
What Godot 4.7.2 prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
SCRIPT ERROR: Parse Error: Identifier "Position2D" not declared in the current scope. Did you mean to use "Marker2D"?
at: GDScript::reload (res://answers/position2d-in-godot-4/repro.gd:4)
ERROR: Failed to load script "res://answers/position2d-in-godot-4/repro.gd" with error "Parse error".
at: load (modules/gdscript/gdscript_resource_format.cpp:46)Fix it
A Marker2D used as a spawn point.
extends Node2D
func _ready() -> void:
var spawn := Marker2D.new()
spawn.position = Vector2(64, 32)
add_child(spawn)
print(spawn.get_class(), " at ", spawn.global_position, ", cross size ", spawn.gizmo_extents)
What the fixed script prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
Marker2D at (64.0, 32.0), cross size 10.0Verified on Godot 4.7.2
Both scripts on this page were run headless on Godot 4.7.2 (4.7.2.stable.mono.official.ed1daf0bf) on 18 October 2026, and the output above is what Godot printed, unedited.
Where the check lives in Godot's source: [gdscript_analyzer.cpp line 4687, the message with its hint](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_analyzer.cpp#L4687), [renames_map_3_to_4.cpp line 1580, Position2D to Marker2D](https://github.com/godotengine/godot/blob/4.7.2-stable/editor/project_upgrade/renames_map_3_to_4.cpp#L1580), [Marker2D class reference](https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/Marker2D.xml).
Questions
- Does a Marker2D show in the running game?
- No. Its cross is drawn only in the editor.
- Can I use a plain Node2D instead?
- Yes; Marker2D is a Node2D with the editor cross, which makes it easier to see and pick.
Related
- YSort in Godot 4: it is Node2D now
- Sprite in Godot 4: it is Sprite2D now
- Every verified Godot 4 answer
- Identifier "…" not declared in the current scope in Godot 4
- How to get the class name of a node in Godot 4: get_class() and get_global_name()
- Spatial in Godot 4: Could not find base class "Spatial"
- ToolButton in Godot 4: use a flat Button
- Cannot get return value of call to "…()" because it returns "void" in Godot 4
Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot.
Download Flockbay free