A
A
Artur Atnagulov2015-09-06 22:52:44
JavaScript
Artur Atnagulov, 2015-09-06 22:52:44

How to launch Unity3D WebGL player with absolute file paths?

Hello!
We are writing a project to view 3D furniture models. The model player is implemented in Unity3D. After chrome disabled NPAPI support and the Unity 3D Plugin stopped working, I had to transfer the model player to WebGL. Building through the Unity development environment works fine, and viewing sofas works fine there too.
But to implement the furniture view library, you need to specify absolute paths to the files that participate in model view (previously - WebPlayer.unity3d, now - WebGLPlayer.js, WebGLPlayer.data, WebGLPlayer.html.mem, etc.). After I achieved the download of all the files, an error began to come out, the stack trace of which goes far into asm.js, which is simply impossible to read.
Error text:

exception thrown: TypeError: Cannot read property 'addEventListener' of undefined,TypeError: Cannot read property 'addEventListener' of undefined
    at Object.JSEvents.registerOrRemoveHandler (http://host/player/WebGL/Release/WebGLPlayer.path_fixed.js:1:115907)
    at Object.JSEvents.registerMouseEventCallback (http://host/player/WebGL/Release/WebGLPlayer.path_fixed.js:1:119681)
    at _emscripten_set_mousedown_callback (http://host/player/WebGL/Release/WebGLPlayer.path_fixed.js:1:191086)
    at BCc (http://host/player/WebGL/Release/WebGLPlayer.path_fixed.js:18:614839)
    at Object.eCc [as _main] (http://host/player/WebGL/Release/WebGLPlayer.path_fixed.js:18:609112)
    at Object.callMain (http://host/player/WebGL/Release/WebGLPlayer.path_fixed.js:31:49538)
    at doRun (http://host/player/WebGL/Release/WebGLPlayer.path_fixed.js:31:50368)
    at run (http://host/player/WebGL/Release/WebGLPlayer.path_fixed.js:31:50536)
    at runCaller (http://host/player/WebGL/Release/WebGLPlayer.path_fixed.js:31:48822)
    at Object.removeRunDependency (http://host/player/WebGL/Release/WebGLPlayer.path_fixed.js:1:28378)

WebGlPlayer.path_fixed.js - the same file as WebGLPlayer.js, only with fixed paths to WebGLPlayer.data and WebGLPlayel.html.mem.
I did not find a solution to the problem on the Internet, since this method of publishing Unity3D projects was just released.
What could be the problem? How to make a custom build of WebGLPlayer.js so that such bugs can be avoided?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artur Atnagulov, 2016-01-07
@atnartur

It was possible to replace paths with crutches through replacing text in files, but this is a crutch.
We decided to open an iframe on the site. And in the iframe, the same index.html from the assembly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question