Allow pre-configuring Script instance properties even when not preloaded

It seems the editor disallows setting properties of a script belonging to a js file that isn’t set to Preload?

Could it be possible to associate a hash of script names (and their configured properties) to their respective JS file paths, and when a scene loads, if the script is not found to be loaded yet due to the JS file path not loaded yet, be able to then load the script paths during runtime on demand and then apply the configured properties once loaded? Of course, this means such scripts will load LATER (ala asyncrounously), and may have issues with other scripts that do require sync timings with them ,but that’s up to the developer’s consideration if they choose to defer loading of such scripts.

Playcanvas doesn’t have such a feature?

Otherwise, how to assositate only loading certain assets (or specific set of preloads only…) for each scene? It seems the Preload setting is set globally per asset rather then per scene.

I noticed that so long as any asset (or js) file is set to preload, it will always load within ANY scene, even when it’s not used in the current scene setup. (Understandably, this may be “necessary” since scripts and other assets may be dynamically added to entities…, but there may be some cases where this isn’t necessarily the case).

Perhaps, having more 3 level preload options per asset would be better. Like: Preload Always, Preload If Used In Editor Scene, Don’t Preload. Having such options makes it much easier to automatically manage what to load per scene, rather than coding the process manually per scene.

Having the preload option for JS scripts was always odd for me as they are relatively small asset wise and normal concatenated as part of the publishing pipeline.

Normally, I tag the assets that are used for specific areas of the app so I can findByTag and unload/load them when needed. Typically for me, I preload enough to get to a title screen and start loading the assets for the game as the user is navigating the menus.

It would be nice for the development workflow to be able to preload certain assets for the scene that is currently being worked on :thinking:

1 Like