Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Web release: serving assets from absolute path

Discussion in 'Project Tiny' started by laserval, Aug 15, 2019.

  1. laserval

    laserval

    Joined:
    Aug 15, 2019
    Posts:
    2
    I have some dynamically generated pages that I want to run my game on. Ideally I would like to put all the assets and scripts for the game in the same place as all other static content (e.g. on a different domain or CDN). I'd prefer avoiding running the game in an iframe.

    When I do a Web release build, the game loads all assets from
    Data/
    , relative to the current page/location. So if the game is inside an article on the path
    www.example.com/articles/3154-project-tiny-is-pretty-cool
    , an asset is request like this:
    www.example.com/articles/3154-project-tiny-is-pretty-cool/Data/06d0a78b7523e833ad43a2db99db271a
    . This means my web service that generates the page also has to handle requests for the static assets (e.g. by redirecting or proxying). The same goes for wherever the game is run, so something like
    www.example.com/articles/3154-project-tiny-is-pretty-cool/comments/3424
    would also have to handle a relative Data path.

    Is there any way to inject a base path for assets, so that the assets can be loaded regardless of where the game is run?