variable-properties.rst 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. .. include:: ../_header.rst
  2. Variable properties
  3. ~~~~~~~~~~~~~~~~~~~
  4. The `variable properties`_ are introduced by the |SceneEditor|_ to be used by the |OutlineView|_ and the `scene compiler <scene-compiler.html>`_.
  5. Name property
  6. `````````````
  7. This name is auto generated by the editor:
  8. .. image:: ../images/scene-editor-name-prop-1-202203281224.webp
  9. :alt: Name property in Inspector view.
  10. It is used as the label in the |OutlineView|_:
  11. .. image:: ../images/scene-editor-name-prop-2-202203281224.webp
  12. :alt: Name property in Outlime.
  13. And as a variable name in the generated code:
  14. .. image:: ../images/scene-editor-name-prop-3-202203281224.webp
  15. :alt: Name property in code.
  16. Display Name property
  17. `````````````````````
  18. You can change the default text of the game object in the |OutlineView|_ by setting the **Display Name** property. This display name is used only by the UI.
  19. .. image:: ../images/scene-editor-variable-display-name-20240109.webp
  20. :alt: Display Name property
  21. .. image:: ../images/scene-editor-variable-display-name-outline-20240109.webp
  22. :alt: Display name in Outline view.
  23. Game Object Name property
  24. `````````````````````````
  25. The **GO Name** property indicates if the previous **Name** property's value will be set as value to the `Game Object's name property <https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.GameObject.html#name>`_.
  26. Check the **GO Name** property:
  27. .. image:: ../images/scene-editor-go-name-prop-3-202203281224.webp
  28. :alt: Enables setting the Game Object's name property.
  29. For generating the ``name`` value in code:
  30. .. image:: ../images/scene-editor-go-name-code-prop-3-202203281224.webp
  31. :alt: Set the variable name as the GO name's value.
  32. Type property
  33. `````````````
  34. This property shows the type of the selected object. In the case of prefabs_, it shows the name of the prefab and the Phaser_ type that is the root of the prefab. For example: ``prefab PlayButton (Image)``.
  35. Also, you can click on the type name to change the type of the selected objects. It opens the `Replace Type dialog <./replace-object-type.html>`_:
  36. .. image:: ../images/scene-editor-variable-type-prop-09182020.webp
  37. :alt: Replace Type dialog.
  38. Scope property
  39. ``````````````
  40. The scope property refers to the lexical scope of the variable that references the object. The possible values are:
  41. * ``LOCAL``: The variable is local to the creation of the object. It is optional, the compiler may generate it or not according if the object properties are modified.
  42. * ``METHOD``: The variable is available in the method's scope.
  43. * ``CLASS``: The variable is assigned to a private class field. The object is accessible from any other method of the class.
  44. * ``PUBLIC``: Like the ``CLASS`` scope, but it is referenced by a public field. The object is accessible to any client of the class.
  45. * ``NESTED_PREFAB``: Like ``PUBLIC``, but the object is also available as `nested prefab <./nested-prefab.html>`_ instance in the Scene Editor. It means, you can change its properties using the scene editor.
  46. By default, the scope is set to ``LOCAL``. In previous versions of the editor, the default value was ``METHOD``, but now we are using ``METHOD`` to ensuring the |SceneCompiler|_ generates a variable for the object.