Skip to content

get_node() does not accept StringName variables as a valid argument #71319

@TisFoolish

Description

@TisFoolish

Godot version

4.0 Beta 11

System information

Win 10, Forward+, 1080ti, 516.94 driver

Issue description

Simply put if you try to get a node by using a StringName as an argument you'll get the error

Parser Error: Invalid argument for "get_node()" function: argument 1 should be "NodePath" but is "StringName".

which is likely an oversight because doing get_name() on a node gives a StringName.

I came across this when I was trying to loop through some nodes, checking names of nodes in an array vs the children of a node, but was able to easily work around it by making the array a string typed array

Steps to reproduce

I uploaded an mrp, but the code is as simple as

var nodeString = StringName("Node")
var test = get_node(nodeString)

Minimal reproduction project

bug.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions