Open TheDuriel opened 1 month ago
Does not seem to happen with all resources (tried with the icon). Probably the Theme is loaded very early, before engine sets the editor hint, so the script instance is created as if the resource was loaded at runtime.
Possibly just a 'needs documentation' case then. It was rather unexpected behavior. (my custom theme tried skinning my whole editor.)
Well, regular scripts should not be executed in editor context. If the context is initialized too late then it's a bug. It can be documented as limitation if the fix is unfeasible.
Tested versions
Reproducible in Godot Engine v4.2.2.stable.official.15073afe3
System information
Windows 10 - Vulkan API 1.3.242 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 2070 SUPER
Issue description
Custom Theme Resources will have their _init() function executed within the editor context, despite no Tool annotation being present.
This may also apply to other Resources defined in the ProjectSettings, if any.
Steps to reproduce
Define a custom Theme Resource as such:
Detailed example: https://github.com/TheDuriel/DurielUtilities/blob/main/FancyTheme/FancyTheme.gd
Define this Them as a Custom Theme in the Project Settings.
Restart the editor.
The Themes _init() function will not be executed, despite the lack of a Tool annotation.
Minimal reproduction project (MRP)
N/A