- Home /
WebGL embed in asp.net mvc
So i made a sudoku game that i want to insert into a webpage i made in asp.net in mvc, i tried to just paste files, but that didn't work so i tried to paste the build folder into the folder with correct view, an in the index.cshtml add the lines
<script src="~/Scripts/UnityLoader.js"></script>
<script>
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/Testing.json");
<script>
<div id="gameContainer" style="width: 775px; height: 600px; margin: auto"></div>
going into the page throws the error which says:
I have no idea where to look for help, since checking debugger says it's the normal part of JSON.parse function, that works if i try to open the index.html file provided by unity, so what do i do?An error occured 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
Hello, I have run into similar problem but I have solved it different way. There is pretty nice website dedicated to indie developers and you can publish your game very easily there. ITCHIO . If you really want to put it into your website, I believe its gonna be some missing .js files but I did not have enough patience to deal with it.
Answer by marman123 · Jan 23, 2019 at 01:41 PM
I face the same problem. I have been struggling with solutions related to web.config file with mime types, but nothing seems to be working for me. Have you come to any solution @Nokimemota for this?
Answer by virus4297 · Oct 21, 2020 at 03:10 PM
I found this amazing answer on StackOverflow. Link Click Here - Can not upload Unity WebGL in ASP.Net with an error of “The error was: SyntaxError: expected expression, got '<”
Your answer
Follow this Question
Related Questions
How do I get into my StreamingAssets folder for the Web? 0 Answers
Reading .json file from WebGL build 0 Answers
Is there any limitations to deserializing json on webgl? 0 Answers
json webGL no work Unity 2018.3.3f1 0 Answers
WebGL Redirect 0 Answers