-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add extra information about templates preload effects #286
Comments
Question: |
That's a good question. @zachpeterpaul, can you help out here please? |
I think when you are dynamically loading something (eg a template asset) that's not preloaded, you need to first manually/dynamically load all dependencies whose 'preload' is unchecked, make sure they all finished loading (using their "on load" callback), and only then load the template asset. I believe this is how PlayCanvas game code is written in other similar cases too. |
Another way to describe this: a template asset only contains entity data, like a PC scene document in mongo. They may have e.g. texture references, but not textures themselves. A dynamically instantiated template allows you to quickly create multiple entities at run time, but you have to make sure yourself that all prerequisites for those entities are already available at that point. |
Thank you @zachpeterpaul, just to answer on my own question:
Means, template, will not trigger load event on related assets, which I believe as a default behaviour - is good! As we want to be able to instantiate template without need to async load it, but we don't want to preload assets, and make engine load them in async when instance of a template becomes used in render. |
The text was updated successfully, but these errors were encountered: