Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Hoeloe · Dec 03, 2017 at 02:18 PM · webgljsonhostgithub

Github Pages with WebGL - JSON error

So I'm trying to host some demo WebGL projects using Github Pages. So far I've created a project, uploaded index.html alongside the Build and TemplateData folders, and added a web.config file next to index.html with the following contents:

 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
 <system.webServer>
 <staticContent>
 <mimeMap fileExtension=".mem" mimeType="application/octet-stream" />
 <mimeMap fileExtension=".data" mimeType="application/octet-stream" />
 <mimeMap fileExtension=".unity3d" mimeType="application/octet-stream" />
 <mimeMap fileExtension=".memgz" mimeType="application/octet-stream" />
 <mimeMap fileExtension=".datagz" mimeType="application/octet-stream" />
 <mimeMap fileExtension=".unity3dgz" mimeType="application/octet-stream" />
 <mimeMap fileExtension=".jsgz" mimeType="application/octet-stream" />
 <mimeMap fileExtension=".unityweb" mimeType="application/octet-stream" />
 <mimeMap fileExtension=".json" mimeType="application/json" />
 </staticContent>
 
 </system.webServer>
 </configuration>

However, on loading the project, I still get this error:

 An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
 SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

Try as I might, I can't seem to find a way around this. Does anyone here know what is wrong?

I don't have the money to spend on hosting, so Github Pages is really my only option (I tried Azure, but it has a very tight bandwidth limit that I went over almost immediately), unless anyone knows of any other free web hosts.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Newtori · Mar 12, 2018 at 02:11 AM

I had the exactly same issue and i fixed it, building my game with Brotli compression Format (Inside Publishing Settings for Webgl in unity), instead of Gzip. Then you have to put this web.config for GitHub web host: You will not need to pay for amazon or azure server :)

 <system.webServer>
         <staticContent>
                 <remove fileExtension=".unityweb" />
                 <mimeMap fileExtension=".unityweb" mimeType="application/octet-stream" />
         </staticContent>
         <rewrite>
                 <outboundRules>
                     <rule name="Append br Content-Encoding header">
                         <match serverVariable="RESPONSE_Content-Encoding" pattern=".*" />
                         <conditions>
                                 <add input="{REQUEST_FILENAME}" pattern="\.unityweb$" />
                         </conditions>
                         <action type="Rewrite" value="br" />
                     </rule>
                 </outboundRules>
         </rewrite>
 </system.webServer>

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

77 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity WebGL doesn't work on github pages. 1 Answer

Error Occurs in Github Pages But Not Unity Game Engine 1 Answer

WebGL uNET Host Server on WAN 0 Answers

How do I get into my StreamingAssets folder for the Web? 0 Answers

WebGL Build Out of Memory Github Pages Not on Local Host 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges