Trouble Converting StringName to int

Godot Version 4.2.1

for i in get_tree().get_nodes_in_group(“InventorySlot”):
var node_name = int(i.get_name())

error: Invalid type in ‘int’ constructor. Cannot convert argument 1 from StringName to String.

I tried converting StringName to String to int didn’t work because I don’t know how to convert StringNme to String read the documentation and looked everywhere didn’t find much

1 Like

you can try this:

for i in get_tree().get_nodes_in_group(“InventorySlot”):
    var node_name = i.get_name().to_int()
3 Likes

Thanks bro I was smashing my head reading stuff
reading everything execpt what I needed I guess

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.