You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Properties in the Sandbox are supported. They are stored in the global scope, and each one has a custom getter and setter function.
350
+
Properties in the Sandbox are supported. They are added through the `add_property()` API function, and each one has a custom getter and setter function.
355
351
356
352

357
353
358
354
Properties can be edited in the Godot inspector and is a powerful and simple way to expose data from the script. The values of these properties are saved in the Godot project and restored on reopening the project.
359
355
360
356
361
-
:::note
362
-
363
-
In this example, the players name cannot be changed in the editor, as the property will just keep returning the same value, _effectively making it read-only_. That is, the getter for the `player_name` property only returns `"Slide Knight"`.
364
-
365
-
:::
366
-
367
357
### Per-instance Sandboxed Properties
368
358
369
359
Sometimes we want properties per instance, even if we have several. In that case, we can access the property based on the value of `get_node()`. A `std::unordered_map` on the `get_node().address()` can be used to achieve this:
0 commit comments