AirConsole Developer Tips&Tricks: Uncaught SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse

This article assumes you have some knowledge of AirConsole. It is going to explain a certain error you might hit along the way.

So, you are working away at your AirConsole game and you want to test it. Your game is working when you try it within Unity, but not after exporting it. The exported version may give you the following error when you try and load your Screen:

Uncaught SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at XMLHttpRequest.t.onload (UnityLoader.js:1)

This error is caused by not selecting AirConsole as your WebGL template. This step can be found on the AirConsole Unity guide, here: https://developers.airconsole.com/#!/guides/unity

 

You must open your Player Settings. You can find this with, File -> Build Settings…

From here, select WebGL and then the Player Settings… button.

Your Inspector will now show some settings, and one of them is titled WebGL Template. Select AirConsole and then re-build your game.

 

That is it! Your game should now work fine.

 

 

Leave your comments and questions below. If you enjoyed this tip, let me know and I will create more.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *