Skip to content

Commit c1a41c9

Browse files
authored
Merge pull request #1233 from Yarwin/update-editor-plugin-docs
Update editor plugin docs.
2 parents e3d1208 + baab660 commit c1a41c9

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

godot-macros/src/lib.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,18 +344,28 @@ use crate::util::{bail, ident, KvParser};
344344
///
345345
/// ## Editor plugins
346346
///
347-
/// If you annotate a class with `#[class(editor_plugin)]`, it will be turned into an editor plugin. The
348-
/// class must then inherit from `EditorPlugin`, and an instance of that class will be automatically added
347+
/// Classes inheriting `EditorPlugin` will be automatically instantiated and added
349348
/// to the editor when launched.
350349
///
351350
/// See [Godot's documentation of editor plugins](https://docs.godotengine.org/en/stable/tutorials/plugins/editor/index.html)
352351
/// for more information about editor plugins. But note that you do not need to create and enable the plugin
353-
/// through Godot's `Create New Plugin` menu for it to work, simply annotating the class with `editor_plugin`
352+
/// through Godot's `Create New Plugin` menu for it to work, simply creating the class which inherits `EditorPlugin`
354353
/// automatically enables it when the library is loaded.
355354
///
356355
/// This should usually be combined with `#[class(tool)]` so that the code you write will actually run in the
357356
/// editor.
358357
///
358+
/// ### Editor plugins -- hot reload interaction
359+
///
360+
/// During hot reload, Godot firstly unloads `EditorPlugin`s, then changes all alive GDExtension classes instances into their base objects
361+
/// (classes inheriting `Resource` become `Resource`, classes inheriting `Node` become `Node` and so on), then reloads all the classes,
362+
/// and finally changes said instances back into their proper classes.
363+
///
364+
/// `EditorPlugin` will be re-added to the editor before the last step (changing instances from base classes to extension classes) is finished,
365+
/// which might cause issues with loading already cached resources and instantiated nodes.
366+
///
367+
/// In such a case, await one frame until extension is properly hot-reloaded (See: [`godot::task::spawn()`](../task/fn.spawn.html)).
368+
///
359369
/// ## Class renaming
360370
///
361371
/// You may want to have structs with the same name. With Rust, this is allowed using `mod`. However, in GDScript

0 commit comments

Comments
 (0)