|
@@ -304,7 +304,7 @@ Combined with :ref:`_set<class_Object_method__set>` and :ref:`_get_property_list
|
|
.. code-tab:: gdscript
|
|
.. code-tab:: gdscript
|
|
|
|
|
|
func _get(property):
|
|
func _get(property):
|
|
- if (property == "fake_property"):
|
|
|
|
|
|
+ if property == "fake_property":
|
|
print("Getting my property!")
|
|
print("Getting my property!")
|
|
return 4
|
|
return 4
|
|
|
|
|
|
@@ -533,9 +533,13 @@ Combined with :ref:`_get<class_Object_method__get>` and :ref:`_get_property_list
|
|
|
|
|
|
.. code-tab:: gdscript
|
|
.. code-tab:: gdscript
|
|
|
|
|
|
|
|
+ var internal_data = {}
|
|
|
|
+
|
|
func _set(property, value):
|
|
func _set(property, value):
|
|
- if (property == "fake_property"):
|
|
|
|
- print("Setting my property to ", value)
|
|
|
|
|
|
+ if property == "fake_property":
|
|
|
|
+ # Storing the value in the fake property.
|
|
|
|
+ internal_data["fake_property"] = value
|
|
|
|
+ return true
|
|
|
|
|
|
func _get_property_list():
|
|
func _get_property_list():
|
|
return [
|
|
return [
|
|
@@ -544,11 +548,14 @@ Combined with :ref:`_get<class_Object_method__get>` and :ref:`_get_property_list
|
|
|
|
|
|
.. code-tab:: csharp
|
|
.. code-tab:: csharp
|
|
|
|
|
|
|
|
+ private Godot.Collections.Dictionary _internalData = new Godot.Collections.Dictionary();
|
|
|
|
+
|
|
public override void _Set(StringName property, Variant value)
|
|
public override void _Set(StringName property, Variant value)
|
|
{
|
|
{
|
|
if (property == "FakeProperty")
|
|
if (property == "FakeProperty")
|
|
{
|
|
{
|
|
- GD.Print($"Setting my property to {value}");
|
|
|
|
|
|
+ // Storing the value in the fake property.
|
|
|
|
+ _internalData["FakeProperty"] = value;
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1099,9 +1106,9 @@ Returns the object's unique instance ID. This ID can be saved in :ref:`EncodedOb
|
|
|
|
|
|
Returns the object's metadata value for the given entry ``name``. If the entry does not exist, returns ``default``. If ``default`` is ``null``, an error is also generated.
|
|
Returns the object's metadata value for the given entry ``name``. If the entry does not exist, returns ``default``. If ``default`` is ``null``, an error is also generated.
|
|
|
|
|
|
-\ **Note:** A metadata's ``name`` must be a valid identifier as per :ref:`StringName.is_valid_identifier<class_StringName_method_is_valid_identifier>` method.
|
|
|
|
|
|
+\ **Note:** A metadata's name must be a valid identifier as per :ref:`StringName.is_valid_identifier<class_StringName_method_is_valid_identifier>` method.
|
|
|
|
|
|
-\ **Note:** Metadata that has a ``name`` starting with an underscore (``_``) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
|
|
|
|
|
+\ **Note:** Metadata that has a name starting with an underscore (``_``) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
|
|
|
|
|
.. rst-class:: classref-item-separator
|
|
.. rst-class:: classref-item-separator
|
|
|
|
|
|
@@ -1221,9 +1228,9 @@ Returns the list of existing signals as an :ref:`Array<class_Array>` of dictiona
|
|
|
|
|
|
Returns ``true`` if a metadata entry is found with the given ``name``. See also :ref:`get_meta<class_Object_method_get_meta>`, :ref:`set_meta<class_Object_method_set_meta>` and :ref:`remove_meta<class_Object_method_remove_meta>`.
|
|
Returns ``true`` if a metadata entry is found with the given ``name``. See also :ref:`get_meta<class_Object_method_get_meta>`, :ref:`set_meta<class_Object_method_set_meta>` and :ref:`remove_meta<class_Object_method_remove_meta>`.
|
|
|
|
|
|
-\ **Note:** A metadata's ``name`` must be a valid identifier as per :ref:`StringName.is_valid_identifier<class_StringName_method_is_valid_identifier>` method.
|
|
|
|
|
|
+\ **Note:** A metadata's name must be a valid identifier as per :ref:`StringName.is_valid_identifier<class_StringName_method_is_valid_identifier>` method.
|
|
|
|
|
|
-\ **Note:** Metadata that has a ``name`` starting with an underscore (``_``) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
|
|
|
|
|
+\ **Note:** Metadata that has a name starting with an underscore (``_``) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
|
|
|
|
|
.. rst-class:: classref-item-separator
|
|
.. rst-class:: classref-item-separator
|
|
|
|
|
|
@@ -1429,9 +1436,9 @@ void **remove_meta** **(** :ref:`StringName<class_StringName>` name **)**
|
|
|
|
|
|
Removes the given entry ``name`` from the object's metadata. See also :ref:`has_meta<class_Object_method_has_meta>`, :ref:`get_meta<class_Object_method_get_meta>` and :ref:`set_meta<class_Object_method_set_meta>`.
|
|
Removes the given entry ``name`` from the object's metadata. See also :ref:`has_meta<class_Object_method_has_meta>`, :ref:`get_meta<class_Object_method_get_meta>` and :ref:`set_meta<class_Object_method_set_meta>`.
|
|
|
|
|
|
-\ **Note:** A metadata's ``name`` must be a valid identifier as per :ref:`StringName.is_valid_identifier<class_StringName_method_is_valid_identifier>` method.
|
|
|
|
|
|
+\ **Note:** A metadata's name must be a valid identifier as per :ref:`StringName.is_valid_identifier<class_StringName_method_is_valid_identifier>` method.
|
|
|
|
|
|
-\ **Note:** Metadata that has a ``name`` starting with an underscore (``_``) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
|
|
|
|
|
+\ **Note:** Metadata that has a name starting with an underscore (``_``) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
|
|
|
|
|
.. rst-class:: classref-item-separator
|
|
.. rst-class:: classref-item-separator
|
|
|
|
|
|
@@ -1576,9 +1583,9 @@ Adds or changes the entry ``name`` inside the object's metadata. The metadata ``
|
|
|
|
|
|
If ``value`` is ``null``, the entry is removed. This is the equivalent of using :ref:`remove_meta<class_Object_method_remove_meta>`. See also :ref:`has_meta<class_Object_method_has_meta>` and :ref:`get_meta<class_Object_method_get_meta>`.
|
|
If ``value`` is ``null``, the entry is removed. This is the equivalent of using :ref:`remove_meta<class_Object_method_remove_meta>`. See also :ref:`has_meta<class_Object_method_has_meta>` and :ref:`get_meta<class_Object_method_get_meta>`.
|
|
|
|
|
|
-\ **Note:** A metadata's ``name`` must be a valid identifier as per :ref:`StringName.is_valid_identifier<class_StringName_method_is_valid_identifier>` method.
|
|
|
|
|
|
+\ **Note:** A metadata's name must be a valid identifier as per :ref:`StringName.is_valid_identifier<class_StringName_method_is_valid_identifier>` method.
|
|
|
|
|
|
-\ **Note:** Metadata that has a ``name`` starting with an underscore (``_``) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
|
|
|
|
|
+\ **Note:** Metadata that has a name starting with an underscore (``_``) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
|
|
|
|
|
.. rst-class:: classref-item-separator
|
|
.. rst-class:: classref-item-separator
|
|
|
|
|