Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Reload browser on change

Discussion in 'Project Tiny' started by nikitaosyak, Dec 6, 2018.

  1. nikitaosyak

    nikitaosyak

    Joined:
    Sep 16, 2013
    Posts:
    2
    Hello.

    First of all, greatly impressed with tiny mode, thanks for all your hard work.

    In the current state of the editor I need to stop play mode and start again to see any changes, if I'm editing code or assets.

    Is it possible in the future to make automatic reload on code edits and\or asset edits? I'm sure you know modern browser toolsets support this with dev servers with reload links and file watchers. That would make work with the editor a complete joy ride.

    Thanks.
     
  2. etienne_unity

    etienne_unity

    Unity Technologies

    Joined:
    Aug 31, 2017
    Posts:
    54
    Hi nikitaosyak,

    Great question. What you can do today is use the watch capabilities of the TypeScript compiler to automatically recompile your .ts scripts.

    We don't support this workflow out of the box, but you can experiment with it. Simply:
    1. open a command prompt, and make sure you have the latest TypeScript compiler available (typing
      tsc --version
      gives you something meaningful)
    2. cd to the Unity project folder. You should see a tsconfig.json file in there - that was generated by Tiny when you opened a Tiny project.
    3. type
      tsc --watch -p tsconfig.json
      to start the watcher. You should get a "Watching for file changes." message.
    Once the watcher is running, you can edit .ts files to trigger script compilation, and directly reload the browser window without having to go back in the Unity Editor, making your iterations on code much faster.

    Note that you'll need to use the Development build configuration, and enable the "Link to Source" option for this to work (these are default settings on new projects).

    The same Link to Source option will work for some assets: streamed (not embedded) textures and audio files using the "Source" export setting. Embedded assets (as data:// URLs) and assets processed by the Unity Editor at export time will not work with this setup, and you'll have to export your game again to iterate.

    Thanks,
    -Etienne.
     
    TheRoccoB likes this.
  3. nikitaosyak

    nikitaosyak

    Joined:
    Sep 16, 2013
    Posts:
    2
    Very helpful, etienne, thanks. That does work!

    I would like to have automatic page refresh also, but I guess this will have to do for now.

    Is there any plans to support improved reloading pipeline in the future? (including automatic page reload)
     
  4. etienne_unity

    etienne_unity

    Unity Technologies

    Joined:
    Aug 31, 2017
    Posts:
    54
    Yes, definitely. One of our design principles in Tiny is to minimize iteration time - you'll see improvements on that front in future releases.