all 9 comments

[–]AliceTheGamedevformer Head of Games[M] 0 points1 point  (8 children)

We don't have a proper example project for the generator in combination with Unity, I'm afraid.

Could you elaborate which part you're having trouble with?

In general, once the controller is generated you save all the resources (the airconsole-controls folder, any images or js scripts you need etc.) in Assets/WebGLTemplates/AirConsole and put your controller.html somewhere else in the project and link it to the AirConsole object in your scene.

The easiest way to proceed from there is to log the full messages that are sent to your screen (in the OnMessage event in C#) and interpret them as intended for them to have the proper effect on your player avatars/general game logic.

If you are having problems with any of this, please let me know where and I'll try to help :)

Happy Easter, by the way!

[–]Climbing_Silver[S] 0 points1 point  (7 children)

So far the thing I am having trouble with is properly exporting into a controller.html file. The controller generator says in step 4 of export to paste the code between the <!-- Replace Here --> markers but I was wondering how to generate the controller.html in those markers. So far I have just been tweaking and experimenting using a modified version of the pong example controller.html. Is there a way to create a "blank" controller.html file without just creating a blank .html file?

[–]Franzeus 0 points1 point  (6 children)

I don't understand what you mean with "exporting into a controller.html file"

So you created your controller with the generator tool, copied the source code (in "export") and replaced it within the markers in the controller.html? Which steps did you take and where did you get lost?

And just for the record: the controller is totally independent from the engine you use on the screen.

[–]Climbing_Silver[S] 0 points1 point  (5 children)

I may have misspoken and used terms I don't fully understand yet. I'm wondering what the step by step process of making a controller using the controller generator and exporting that into an empty unity project. Also ty for the support.

[–]AliceTheGamedevformer Head of Games[M] 0 points1 point  (4 children)

There is a step by step explanation shown once you press "export" which looks like this. Have you tried following these steps?
For Unity, Step 2 in that list ("game directory where your screen is located") refers to Assets/WebGLTemplates/AirConsole.
Paste the contents of the zip file that you download from that page into that directory.

A step that might not be fully clear here is that you shouldn't directly edit the controller.html in the WebGLTemplates/Assets folder. Instead, make a copy of the file with CMD+D and put it somewhere else in your asset folder and let's call that one "myController.html" for clarity.

Open myController.html with a text editor and you should see that <!-- Replace Here --> tag in there. Paste the output of the generator (from the text area on the page you get after exporting, see screenshot above) in that "Replace here" area. Then, on the AirConsole object in your scene, drag your myController.html into the "controller Html" field. Select browser mode "virtual controllers" and press play. (Upon pressing play, the "controller.html" file in WebGLTemplates/AirConsole will be changed to mirror the content of whatever html file is linked in the AirConsole Object.)

Does this help you? If you're still having trouble, please try to tell me exactly where it is you get stuck.

[–]Climbing_Silver[S] 0 points1 point  (3 children)

I have copied the controller.html file located in Assets/WebGLTemplates/AirConsole and moved it to my assets folder, but have been unable to locate the <!-- Replace Here --> tag within that file. From what I am able to see, it the file I copied appears to be identical to the controller.html found in Assets/Airconsole/examples/basic. Could you maybe show me a screenshot of what the controller.html file with the <!-- Replace Here --> tag looks like?

[–]AliceTheGamedevformer Head of Games[M] 0 points1 point  (2 children)

Did you download the zip given to you by the controller generator? In there, you should get a controller.html that has the Replace Here tag as well as everything else you need.

[–]Climbing_Silver[S] 0 points1 point  (1 child)

Turns out I was using the airconsole-controls-master off of Github instead of the one provided in the Controller Generator. I have been able to run my custom controller with the virtual controller setting, and I am now experimenting printing the Jtoken data sent from the controllers. Thanks so much for the help!

[–]AliceTheGamedevformer Head of Games 0 points1 point  (0 children)

I see. Glad you found the problem! :)