From 7f7042c515b3599da831b487c6ec8a9c11924b74 Mon Sep 17 00:00:00 2001 From: Justin McGettigan Date: Sat, 18 Mar 2023 03:22:25 -0400 Subject: [PATCH] Updated instances of onready to @onready. --- .../custom_resource_format_loaders.rst | 2 +- .../documentation/docs_writing_guidelines.rst | 12 ++++++------ tutorials/2d/2d_sprite_animation.rst | 4 ++-- tutorials/scripting/gdscript/gdscript_styleguide.rst | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/contributing/development/core_and_modules/custom_resource_format_loaders.rst b/contributing/development/core_and_modules/custom_resource_format_loaders.rst index 8ff0bab1c..cec46a777 100644 --- a/contributing/development/core_and_modules/custom_resource_format_loaders.rst +++ b/contributing/development/core_and_modules/custom_resource_format_loaders.rst @@ -380,7 +380,7 @@ Then attach the following script to any node:: extends Node - onready var json_resource = load("res://demo.json") + @onready var json_resource = load("res://demo.json") func _ready(): print(json_resource.get_dict()) diff --git a/contributing/documentation/docs_writing_guidelines.rst b/contributing/documentation/docs_writing_guidelines.rst index 005e19a66..0b44178e3 100644 --- a/contributing/documentation/docs_writing_guidelines.rst +++ b/contributing/documentation/docs_writing_guidelines.rst @@ -348,10 +348,10 @@ could use the code snippets in a live project. **Don't** write made-up examples: -:: +.. code-block:: gdscript - onready var a = preload("res://MyPath") - onready var my_node = $MyNode + @onready var a = preload("res://MyPath") + @onready var my_node = $MyNode func foo(): @@ -359,10 +359,10 @@ could use the code snippets in a live project. **Do** write concrete examples: -:: +.. code-block:: gdscript - onready var sfx_player_gun = preload("res://Assets/Sound/SFXPlayerGun.ogg") - onready var audio_player = $Audio/AudioStreamPlayer + @onready var sfx_player_gun = preload("res://Assets/Sound/SFXPlayerGun.ogg") + @onready var audio_player = $Audio/AudioStreamPlayer func play_shooting_sound(): diff --git a/tutorials/2d/2d_sprite_animation.rst b/tutorials/2d/2d_sprite_animation.rst index 54dc884dc..73affafa8 100644 --- a/tutorials/2d/2d_sprite_animation.rst +++ b/tutorials/2d/2d_sprite_animation.rst @@ -78,7 +78,7 @@ released. extends CharacterBody2D - onready var _animated_sprite = $AnimatedSprite2D + @onready var _animated_sprite = $AnimatedSprite2D func _process(_delta): if Input.is_action_pressed("ui_right"): @@ -219,7 +219,7 @@ released. extends CharacterBody2D - onready var _animation_player = $AnimationPlayer + @onready var _animation_player = $AnimationPlayer func _process(_delta): if Input.is_action_pressed("ui_right"): diff --git a/tutorials/scripting/gdscript/gdscript_styleguide.rst b/tutorials/scripting/gdscript/gdscript_styleguide.rst index 921715012..a9fed97f9 100644 --- a/tutorials/scripting/gdscript/gdscript_styleguide.rst +++ b/tutorials/scripting/gdscript/gdscript_styleguide.rst @@ -711,10 +711,10 @@ We suggest to organize GDScript code this way: 05. signals 06. enums 07. constants - 08. exported variables + 08. @export variables 09. public variables 10. private variables - 11. onready variables + 11. @onready variables 12. optional built-in virtual _init method 13. optional built-in virtual _enter_tree() method