Is there a way to run a PlayCanvas app with specific parameters defined by the apps url?

Can I for example add something to the web address to set certain variables at startup?

For example I would like to start the app showing a certain model if the user goes to the link like this:
www.myapp/?model_a

or of the user follows another link the app opens with slightly different parameters:
www.myapp/?model_b

Is this possible? If so, how do I check those variables when the app runs?

If it’s not possible is there another way other than having the app duplicated multiple times at different addresses?

Thanks
Simon

You can use URL params https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript

Once you have that, you can load assets and do whatever custom logic you need based on the query string

Edit: I might have to check if that works with the publish link or if you need to use the iframe-less version.

1 Like