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 /
  • Help Room /
avatar image
2
Question by Miiirage · May 19, 2016 at 05:21 PM · webglnodejsheadlessbackend

Using Unity's WebGL export in Node.js

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?

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

0 Replies

· Add your reply
  • Sort: 

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

57 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

Related Questions

Unity3d and Node.js backend 2 Answers

Sending live data to multiple WebGL clients from a single host instance 0 Answers

Is there a possibility to use System.IO.Ports in WebGL(Scripting backend IL2CPP)? 0 Answers

Detect if WebGL is on Facebook canvas 1 Answer

Load Scene from assetbundle WebGL (lightmapped) 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