system
September 9, 2020, 1:52pm
1
Attention
Topic was automatically imported from the old Question2Answer platform.
Asked By
Tort
if Input.is_action_just_pressed('ui_x'):
var test = $objects/test
test.name = '@test@42'
print(test.name)
Print issues test42
system
September 9, 2020, 10:06pm
2
Reply From:
jgodfrey
The @
is a special character used in node names to indicate to the engine that the node was instanced without an explicit name.
Apparently, the @
gets stripped from the string as it’s assigned to the name
property. So, in your example, it’s not that the @
symbol isn’t printing. Instead, it was stripped during the assignment itself and isn’t stored as part of the name.
See the following for more info and context:
opened 04:45PM - 02 Apr 19 UTC
discussion
topic:core
**Godot version:**
3.1
**OS/device including version:**
Arch linux
*… *Issue description:**
If you make multiple instances of the same nodetype, godot names the first instance after the node type and the other ones are prefixed with an @ and suffixed with an @ and a number. For example, if you create two Nodes of type GraphNode, the first instances name is "GraphNode" and the seconds name is "@GraphNode@288" or something like this.
If you want to rename an instance and it does include an @, the @ gets discarded.
```
var node = GraphNode.instance()
add_child(node)
node.set_name("@GraphNode@200")
print(node.get_name()) # prints GraphNode200
```
This is problematic if you want to save and load node data and node-connections.
**Steps to reproduce:**
Make an GraphEdit, attach a script to it. In the script, create an instance of GraphNode and add it as a child. Set it's name to "@GraphNode@100". After that, print the name of the nodes instance. The name is "GraphNode100" and not "@GraphNode@100"
opened 02:09PM - 25 Oct 19 UTC
closed 07:06PM - 17 Oct 20 UTC
bug
topic:editor
confirmed
documentation
**Godot version:** v3.1.1.stable.official
**OS/device including version:**: 5… .3.7-arch1-1-ARCH
**Issue description:** At signs in node names are filtered on node renaming
**Steps to reproduce:**
1: Adds any two same scene in the scene tree
2: Do `node.name = node.name` on the one renamed by the engine
**Minimal reproduction project:** [name_issue.zip](https://github.com/godotengine/godot/files/3772426/name_issue.zip)
**Some screenshots:**
Expected behavior:
![DeepinScreenshot_select-area_20191025160758](https://user-images.githubusercontent.com/1417856/67577914-ada94f80-f741-11e9-9716-fb0f2e7e2080.png)
Observed behavior:
![DeepinScreenshot_select-area_20191025160811](https://user-images.githubusercontent.com/1417856/67577929-bac63e80-f741-11e9-9ea3-f54224b89c4b.png)