Placeholder resources #4779
maksloboda
started this conversation in
Scripting
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Lets say that I want to load some resource on demand.
Common pattern goes like this:
Resource is loaded on demand but we've got a problem, what if the resource moves? In that case our code becomes broken. As a cherry on top this resource is not marked as a dependency, so it can be deleted/moved by an unsuspecting colleague.
Right, but that's what we have export for right?
Lets inspect this code:
Now we have code that tracks the resource path but in return dependency gets loaded when the scene gets loaded.
Okay, but so what? When not using
load
even small projects take a long time to start the game because they need to load nearly everything at once. Level select would have a reference to every level which has a reference to every object and so on.There exists a feature, that i don't hear about often, called "Load as placeholder". This feature works only for scenes and does almost what i need.
It is possible to create a scene that has an object that contains a Resource. Example:
But because of the inner mechanics of the child scenes it would require to create and setup separate scene for each resource.
TLDR:
Current resource handling is limited and leads to tradeoff between:
Proposed solutions:
export(String, FILE)
that updates dependencies of the scene and tracks specified resource.ProxyResource
that has one methodResource load()
and allows to create such indirect references.Beta Was this translation helpful? Give feedback.
All reactions