Hello everyone,
I have a PlayCanvas app initialized with the following configuration snippet:
createOptions.keyboard = INPUT_SETTINGS.useKeyboard ? new pc.Keyboard(window) : null;
createOptions.mouse = INPUT_SETTINGS.useMouse ? new pc.Mouse(canvas) : null;
createOptions.gamepads = INPUT_SETTINGS.useGamepads ? new pc.GamePads() : null;
createOptions.touch = INPUT_SETTINGS.useTouch && pc.platform.touch ? new pc.TouchDevice(canvas) : null;
createOptions.assetPrefix = window.ASSET_PREFIX || ‘’;
createOptions.scriptPrefix = window.SCRIPT_PREFIX || ‘’;
createOptions.scriptsOrder = window.SCRIPTS || ;
createOptions.soundManager = new pc.SoundManager();
createOptions.lightmapper = pc.Lightmapper;
createOptions.batchManager = pc.BatchManager;
createOptions.xr = pc.XrManager;
app.init(createOptions);
My question is: When window.ASSET_PREFIX or window.SCRIPT_PREFIX need to be updated dynamically (e.g., switching between different environments or asset servers), how can I apply these changes to the existing app instance without re-creating and re-initializing the entire app object?
Re-initializing the app would reset the game state, which I want to avoid. Are there any built-in methods or properties in the PlayCanvas App class to modify these prefixes at runtime? Or is there a recommended approach to handle dynamic updates of asset/script prefixes post-initialization?
Any insights or examples would be greatly appreciated! Thank you.