Update some screenshots in the Scripting section for Godot 4 (#6851)
|
Before Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 27 KiB |
@@ -59,14 +59,14 @@ options for a class called ``PlayerController``.
|
||||
You've probably stored a node in a variable before, and typed a dot to
|
||||
be left with no autocomplete suggestions:
|
||||
|
||||
.. figure:: img/typed_gdscript_code_completion_dynamic.png
|
||||
.. figure:: img/typed_gdscript_code_completion_dynamic.webp
|
||||
:alt: code completion options for dynamic
|
||||
|
||||
This is due to dynamic code. Godot cannot know what node or value type
|
||||
you're passing to the function. If you write the type explicitly
|
||||
however, you will get all public methods and variables from the node:
|
||||
|
||||
.. figure:: img/typed_gdscript_code_completion_typed.png
|
||||
.. figure:: img/typed_gdscript_code_completion_typed.webp
|
||||
:alt: code completion options for typed
|
||||
|
||||
In the future, typed GDScript will also increase code performance:
|
||||
@@ -202,7 +202,7 @@ node: ``($Timer as Timer)``, ``($Player as CharacterBody2D)``, etc.
|
||||
Godot will ensure the type works and if so, the line number will turn
|
||||
green at the left of the script editor.
|
||||
|
||||
.. figure:: img/typed_gdscript_safe_unsafe_line.png
|
||||
.. figure:: img/typed_gdscript_safe_unsafe_line.webp
|
||||
:alt: Unsafe vs Safe Line
|
||||
|
||||
Unsafe line (line 7) vs Safe Lines (line 6 and 8)
|
||||
|
||||
@@ -9,13 +9,17 @@ mistakes that are hard to spot during development, and that may lead
|
||||
to runtime errors.
|
||||
|
||||
You can configure warnings in the Project Settings under the section
|
||||
called **Gdscript**:
|
||||
called **GDScript**:
|
||||
|
||||
.. figure:: img/typed_gdscript_warning_system_settings.png
|
||||
.. figure:: img/typed_gdscript_warning_system_settings.webp
|
||||
:alt: Warning system project settings
|
||||
|
||||
Warning system project settings
|
||||
|
||||
.. note::
|
||||
|
||||
As shown in the image above, you must enable **Advanced Settings** in order to see the GDScript section.
|
||||
|
||||
You can find a list of warnings for the active GDScript file in the
|
||||
script editor's status bar. The example below has 3 warnings:
|
||||
|
||||
|
||||