I'm asking this question here too so that I can finally get this solved. Original post also here
So my problem is that I'm trying to integrate Unity game in to our own system. Game needs to take parameters as "setup" from our system and use them in the game. When game is done it does callback function sending things back to our system. This all works perfectly in the game when I deploy and use the index file created during the build to WebGL platform game.However I have managed to encounter the above error when trying to integrate and run the game within our system.
First solution I tried to was the use of by creating it with JQuery from the init.js file. In the iframe, i just open the index.html file generated by Unity build and it shows the game inside the iframe without problems. (in this point, I have not change anything in the files given from Unity) So this solution works well.
$(this.getElement()).append('<iframe src="xxxx/xxxx/xxxx/index.html" height="768" width="1024" frameborder="0"></iframe>');
Sending parameters through iframe is the last thing you want do as the only way to do it is through the url. So I wanted to find a way around this and found out that it's possible (and even advisable) to do so. One solution was to just get all the code from the index.html file and put it to the init.js file where I first had the iframe.
So when our system runs the init.js file it creates the canvas (that index.html already had) and then other scripts as the index.html did too and in the same order. I debugged the whole code with console.log() and it went through code normally. The error occurred after the system had ran through init.js and Unity should start working (basically after the unity should have had loaded all necessary things to run). Where did I go wrong, when the game throws me ""RangeError: Maximum call stack size exceeded" with chrome and ”Too much recursion” error with Firefox. Could it be the order of the script to run in the init.js which mixes up the whole loading or what?
I also put debugs to the UnityConfig.js and fileloader.js files just to make sure where the error comes from. Actually when the system ran through fileloader I noticed that there is some change between the execution orders when I run the code within the system or through iframe or straightly from index.html. Could that be the source of the problem too, and if it is, what should I do to fix this.
I know that iframe is the working solution, but NO, I don't want to use it.