Dedicated Initializers for Editor-based Resource Creation #12007
Schadenvoid
started this conversation in
Scripting
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Issue:
Creating resources in the inspector is decidedly lacking where initialization is concerned.
The initialization of internal resource member variables through "...-.new()" does not occur. There also does not seem be a way to initialize member variables of derived scripts.
The tool annotation makes resource member variable initialization work, but it also calls the _init() method, which:
a. isn't fit for the initialization of variables through editor creation, since it may undo tweaks made in editor.
and
b. could be used for initialization outside of the editor creation of resource assets, making it not ideal for it to be called in this instance.
The conclusion is that, instead, every internal resource has to be created and configured manually, which is a tedious affair that eats away at precious development time.
Proposal:
An override-able Object-based method that is specifically used for the initial creation of an object in the editor. One that is able to perform a variety of initialization tasks that would otherwise be awkward or require input to be done manually for each and every instance of a large glut of resources (which is what I'm trying to avoid in the first place.) It could potentially even provide functionality to the creation of nodes in the scene tree in editor.
I haven't found any other way of doing so programmatically that works in the manner I would prefer, so it would be nice to have as a general feature. Thanks for your consideration.
Beta Was this translation helpful? Give feedback.
All reactions