Search code examples
unity-game-engineairconsole

Multi-page Airconsole controller?


I'm just starting to create a controller for use with Airconsole. I'd like it to be somewhat complicated and will be using Angular to create different pages.

In Unity, I can drag in a controller.html file. However, I've been getting resource not found errors when I try to access say controller.js or controller.css. How can I upload multliple files to the Airconsole host? Is there a general pattern used by other games?

So far I'm considering

  1. hosting my app separately and just redirecting to my separate web page. This seems to give errors in the emulator though.

  2. Compiling the entire app into just one HTML file.. Not sure how to get these entirely into one file. When I run ng build I get a smaller dist compiled file, but it still consists of several smaller files. Will try dragging that into Unity and trying again. But dragging the entire Angular project inside Unity felt like a really bad idea..

  3. Link to files hosted on separate pages but still have the uploaded HTML file do something.. But not sure how much I need to do here vs how much I can move to other files that I host.


Solution

  • My basic "how to include other files" question was answered well by another question: How to include js and css.

    For the more generic question of working with Angular, I still haven't quite figured it out. But what I'm doing at the moment:

    I have an Angular project outside of Unity. I run ng build to compile everything into a folder dist. Then two options work:

    Deploy the dist folder to static file hosting and change index.html's relative links to point to the separately hosted files with <base href="https://cloudfilehosting/airconsole-host/">

    OR

    Copy the dist folder into Unity's Assets/WebGLTemplates/AirConsole folder.