-
-
Notifications
You must be signed in to change notification settings - Fork 19k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin fails to load textures because they get imported too late #17483
Comments
I've seen this too. I'm not sure how to solve though. Should the editor only enable the plugins after everything was imported? |
@vnen what has been tried? |
@FeralBytes when an addon is installed from asset lib, resource import can be triggered before enabling the plugin, so no need to restart Godot. |
A work around that seems to work for me is during the plugin startup yield for 3 frames and then use load() on the SVGs during the plugin startup. Have to take care though if it exits somehow during one of these frames. |
ContextI encountered this issue while attempting to help someone get an Android plugin working: https://old.reddit.com/r/godot/comments/f4uhpk/i_get_stuck_with_android_plugin/ It took a lot of time to track down what was causing the issue. (And it was unrelated to the Android-specific issue that also existed.) WorkaroundsAfter further research I think the simplest workaround is to change all image-related uses of At least in the case of There are still a number of red engine error messages output in the console but there's no error dialog popup and the functionality still works. Here's a patch to a plugin that implements this change: funabab/godot-camera-plugin-demo@313f626 (In addition, in the above patch I'm removing a more complex workaround which used Underlying causes & impactMy impression is that the implications of the background resource import functionality may not have been fully considered when the editor plugin functionality was added. Which is understandable given that the issue primarily seems to appear once at start-up when a plugin is copied/"installed" directly from a source repository such as GitHub. Unfortunately this edge case occurs immediately for people using someone else's plugin which isn't yet in the asset store & creates a poor first impression of the plugin & is non-trivial to debug--and discover the underlying issue is with the engine. So, while the issue can be worked around to some degree (and the Potential fix approachesJumping back for a second, I wonder if background resource importing shouldn't be the default when no As mentioned in the
So, I think it could be considered reasonable for [To be continued: I have further thoughts/research around this issue but will make this do for now.] |
Maybe was related: #39313 |
I went down this rabbit hole again in #36417 (comment) but seeing as it relates to this issue I'll repeat the TLDR here... TL;DR: Editor plugins shouldn't attempt to use the resource system during initialization despite documentation stating otherwise. Suggested workarounds:
There's a bunch more investigation/context in #36417 (comment) but thought I probably shouldn't copy the whole thing here. :) |
…art-up error in new projects Related issue: godotengine/godot#17483
Tested with this code in Godot 4.3: @tool
extends EditorPlugin
func _enter_tree() -> void:
print(preload("res://addons/ploogin/icon.svg")) It spits errors, but the texture is then printed correctly. The plugins will retry loading after initial import if they fail on first load, so this is effectively resolved. The errors are not important if they don't break anything. |
Godot 3.0.2
I made a plugin which has SVG icons and some textures, but I noticed if I clone the repo and then open it in an empty project, it opens but all plugin's textures fail to load because Godot has not imported them yet.
This happens when you open a project with an enabled plugin inside, but before the first import happened (typically cloning a repo or maybe even installing the plugin).
The text was updated successfully, but these errors were encountered: