Quantcast
Channel: Questions in topic: "webgl"
Viewing all articles
Browse latest Browse all 2390

Using Unity's WebGL export in Node.js

$
0
0
We have made a development export to WebGL. This runs fine in the Browser, however we are trying to make it run as a headless unity server. In the source-code we see several references to Node.js support, such as `ENVIRONMENT_IS_NODE` and the following included snippet: requestAnimationFrame: function requestAnimationFrame(func) { if (typeof window === 'undefined') { // Provide fallback to setTimeout if window is undefined (e.g. in Node.js) Browser.fakeRequestAnimationFrame(func); } else { ... } We found, however, that we need to stub and mock many interfaces such as `navigator`, `window`, `document` and `window.indexedDB`. Many of these we addressed and now we get to the point where we're processing data loaded from the `projectname.data`, into several `DataRequests`: new DataRequest(0, 64506, 0, 0).open('GET', '/data.unity3d'); new DataRequest(64506, 64527, 0, 0).open('GET', '/methods_pointedto_by_uievents.xml'); new DataRequest(64527, 64548, 0, 0).open('GET', '/preserved_derived_types.xml'); new DataRequest(64548, 1444752, 0, 0).open('GET', '/Il2CppData/Metadata/global-metadata.dat'); new DataRequest(1444752, 2940812, 0, 0).open('GET', '/Resources/unity_default_resources'); new DataRequest(2940812, 2968437, 0, 0).open('GET', '/Managed/mono/2.0/machine.config'); After this, we got stuck with `abort()` called in the memory allocation function `_malloc`. We're thinking this is due to the virtual memory overflowing. The error is probably not very helpful, but here it is regardless: 7:03:18 PM web.1 | /Users/Name/Projects/unity-headless/server/Development/ourprojectnamedev.js:203 7:03:18 PM web.1 | throw ex; 7:03:18 PM web.1 | ^ 7:03:18 PM web.1 | abort() at Error 7:03:18 PM web.1 | at jsStackTrace (/Users/Name/Projects/unity-headless/server/Development/ourprojectnamedev.js:1280:13) 7:03:18 PM web.1 | at stackTrace (/Users/Name/Projects/unity-headless/server/Development/ourprojectnamedev.js:1297:22) 7:03:18 PM web.1 | at Object.abort (/Users/Name/Projects/unity-headless/server/Development/ourprojectnamedev.js:2326211:44) 7:03:18 PM web.1 | at _abort (/Users/Name/Projects/unity-headless/server/Development/ourprojectnamedev.js:9050:22) 7:03:18 PM web.1 | at _malloc (/Users/Name/Projects/unity-headless/server/Development/ourprojectnamedev.js:2273802:8) 7:03:18 PM web.1 | at __Znwj [operator new()] (/Users/Name/Projects/unity-headless/server/Development/ourprojectnamedev.js:2262786:8) 7:03:18 PM web.1 | at __ZN6il2cpp2os16ThreadLocalValueC2Ev [il2cpp::os::ThreadLocalValue::ThreadLocalValue()] (/Users/Name/Projects/unity-headless/server/Development/ourprojectnamedev.js:57449:8) 7:03:18 PM web.1 | at __GLOBAL__sub_I_Thread_cpp (/Users/Name/Projects/unity-headless/server/Development/ourprojectnamedev.js:1338362:2) 7:03:18 PM web.1 | at asm.__GLOBAL__sub_I_Thread_cpp (/Users/Name/Projects/unity-headless/server/Development/ourprojectnamedev.js:2324046:40) 7:03:18 PM web.1 | at __ATINIT__.push.func (/Users/Name/Projects/unity-headless/server/Development/ourprojectnamedev.js:1718:9) My question is: **How can we enable support for running WebGL-generated builds into Node.js to use (or mold) this codebase for a potential back-end server?**

Viewing all articles
Browse latest Browse all 2390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>