# Unreal.js

**URL:** <https://forums.unrealengine.com/t/unreal-js/48058>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [November 21, 2015, 1:58am UTC](https://forums.unrealengine.com/t/unreal-js/48058 "2015-11-21T01:58:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_089fe201](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_089fe201](https://forums.unrealengine.com/u/anonymous_user_089fe201)\
**Post date:** [November 21, 2015, 1:58am UTC](https://forums.unrealengine.com/t/unreal-js/48058/1 "2015-11-21T01:58:07Z")

</div>

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

Available on the Marketplace! (Sep 1 2016)

Full access to UnrealEngine via reflection.

> **[GitHub - ncsoft/Unreal.js: Unreal.js: Javascript runtime built for UnrealEngine](https://github.com/ncsoft/Unreal.js)**
>
> Unreal.js: Javascript runtime built for UnrealEngine - GitHub - ncsoft/Unreal.js: Unreal.js: Javascript runtime built for UnrealEngine

Tutorial video: [Getting Started with Unreal JS - YouTube](https://www.youtube.com/watch?v=XxPSLjBg7DU)

---

<div class="post-metadata">

**Author:** ![Mr\_SquarePeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mr\_SquarePeg](https://forums.unrealengine.com/u/Mr_SquarePeg)\
**Post date:** [November 21, 2015, 2:18am UTC](https://forums.unrealengine.com/t/unreal-js/48058/2 "2015-11-21T02:18:37Z")

</div>

This looks awesome 😃

---

<div class="post-metadata">

**Author:** ![Dannington](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dannington](https://forums.unrealengine.com/u/Dannington)\
**Post date:** [November 21, 2015, 10:17am UTC](https://forums.unrealengine.com/t/unreal-js/48058/3 "2015-11-21T10:17:56Z")

</div>

This looks great! I’ve got a few things which I implement at the moment using python and a socket interface with ue. I’d love to contain it all within the engine. At the moment I use python to load excel files into arrays and also act as an osc server which I use to trigger unreal events. Is it easy, do you think, to use unreal js to do these things internally? There are osc and excel libraries for js (I have zero experience with js).

Nice work !

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_089fe201](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_089fe201](https://forums.unrealengine.com/u/anonymous_user_089fe201)\
**Post date:** [November 21, 2015, 11:20am UTC](https://forums.unrealengine.com/t/unreal-js/48058/4 "2015-11-21T11:20:45Z")

</div>

Unreal.js isn’t compatible with node.js, but most of node.js features are not bound to its internal modules(process, net, fs, …). I don’t know how excel-parser is implemented, if the module can take binary buffer or array, you can do import \*.xlsx and do the things what you want with Unreal.js.

If you find missng functionality what you want to use, just implement a C++ function within your UBlueprintFunctionLibrary([A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums](https://wiki.unrealengine.com/Blueprint_Function_Library,_Create_Your_Own_to_Share_With_Others)). That function will be accessible immediately. (No needs to add glue code)

Thank you! 🙂

– Just added some example, please check out updated README.md

---

<div class="post-metadata">

**Author:** ![Tim\_Sweeney](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tim\_Sweeney](https://forums.unrealengine.com/u/Tim_Sweeney)\
**Post date:** [November 21, 2015, 9:10pm UTC](https://forums.unrealengine.com/t/unreal-js/48058/5 "2015-11-21T21:10:20Z")

</div>

Wow! This is amazing! Thank you nako\_sung!

---

<div class="post-metadata">

**Author:** ![Dannington](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dannington](https://forums.unrealengine.com/u/Dannington)\
**Post date:** [November 21, 2015, 10:54pm UTC](https://forums.unrealengine.com/t/unreal-js/48058/6 "2015-11-21T22:54:01Z")

</div>

Thanks - praise from the big man too!

Looks like i’ve got some JS experimentation to get on with. I’ll keep this thread informed on how I get on here. I feel like this is going to be a pretty long thread when people spot it!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_089fe201](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_089fe201](https://forums.unrealengine.com/u/anonymous_user_089fe201)\
**Post date:** [November 22, 2015, 1:16am UTC](https://forums.unrealengine.com/t/unreal-js/48058/7 "2015-11-22T01:16:22Z")

</div>

I hope you enjoy hacking UnrealEngine with .js! 🙂

---

<div class="post-metadata">

**Author:** ![AMIGrAve](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AMIGrAve](https://forums.unrealengine.com/u/AMIGrAve)\
**Post date:** [November 23, 2015, 7:04am UTC](https://forums.unrealengine.com/t/unreal-js/48058/8 "2015-11-23T07:04:16Z")

</div>

This is awesome !!! Really !!!  
I do not have the time to test it for now but I will for sure as soon as I can.

How portable do you think it is ?  
I remember iOS builds could not embed jit based VMs such as v8.  
Is that old news ?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_089fe201](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_089fe201](https://forums.unrealengine.com/u/anonymous_user_089fe201)\
**Post date:** [November 23, 2015, 9:54am UTC](https://forums.unrealengine.com/t/unreal-js/48058/9 "2015-11-23T09:54:43Z")

</div>

Thank you, AMIGrAve!

Mobile support is something I expected to be happened with the community. There is some working iOS build ([GitHub - frida/v8: Frida depends on V8](https://github.com/frida/v8)), but I don’t know about Apple’s policy about JIT VM. If Apple is forcing to use their JavascriptCore, Unreal.js needs to be redesigned to support several Javascript providers.

–(edit)–

> **[iOS 8 brings same JavaScript performance as Safari to third-party apps](https://ijunkie.com/ios-8-javascript-performance-safari-apps/)**
>
> iOS 8's WebKit brings same Javascript performance as Safari to third-party apps

---

<div class="post-metadata">

**Author:** ![getnamo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/getnamo/32/1194624_2.png) [@getnamo](https://forums.unrealengine.com/u/getnamo)\
**Post date:** [November 23, 2015, 8:43pm UTC](https://forums.unrealengine.com/t/unreal-js/48058/10 "2015-11-23T20:43:00Z")

</div>

This is awesome. Not quite sure yet where I will use it, but that will come with familiarity!

Edit:  
Does this load js at runtime? e.g. could this be used to enable people to script mini-games within games? Possibilities…

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_089fe201](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_089fe201](https://forums.unrealengine.com/u/anonymous_user_089fe201)\
**Post date:** [November 23, 2015, 10:42pm UTC](https://forums.unrealengine.com/t/unreal-js/48058/11 "2015-11-23T22:42:07Z")

</div>

Yes. Code is being loaded at runtime. Class declaration(and live reload) also takes in place while running. If you have a good package manager like npm, there will be lots of possibilities.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_089fe201](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_089fe201](https://forums.unrealengine.com/u/anonymous_user_089fe201)\
**Post date:** [November 24, 2015, 4:35pm UTC](https://forums.unrealengine.com/t/unreal-js/48058/12 "2015-11-24T16:35:06Z")

</div>

I forgot to implement USTRUCT and updated to support it. Dynamic unreal engine is a real fun. By the way, we(ncsoft) are using this plugin for rapid-prototyping and editor extension.

---

<div class="post-metadata">

**Author:** ![NickDarnell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NickDarnell](https://forums.unrealengine.com/u/NickDarnell)\
**Post date:** [November 24, 2015, 7:10pm UTC](https://forums.unrealengine.com/t/unreal-js/48058/13 "2015-11-24T19:10:11Z")

</div>

This is fantastic work, can’t wait to see how this evolves.

---

<div class="post-metadata">

**Author:** ![mflux](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mflux](https://forums.unrealengine.com/u/mflux)\
**Post date:** [November 26, 2015, 2:22am UTC](https://forums.unrealengine.com/t/unreal-js/48058/14 "2015-11-26T02:22:26Z")

</div>

Hey , thanks again for making this.

I’m still very new to Unreal so please bear with me.

What is the best way to pass information from JS to Unreal?

For example I have a ProceduralMesh like so:

 ![procmesh.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/d/0d58d157e7ec7d6bc3b6bf94531d05da0a9cdb3f.png)

It also has a UnrealJS component. With JS code here:

 ![procmesh.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/4/1/a410d212b246c3ae3a301060112dff98e55d075d.png)

My goal is to use JS to generate the mesh (with something like THREE.js) and then inject the vertices, faces, and UVs back into Unreal. Can anyone think of a good way to do this?

I’m thinking to create a custom Actor in JS that hold information about the generated vertices, and then from Blueprint I can somehow reference that actor and obtain that data. However this seems extremely naive, not even sure if I can get pins from a JS-generated class. I’m wondering if there are better ways to do this?

---

<div class="post-metadata">

**Author:** ![Nate](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nate](https://forums.unrealengine.com/u/Nate)\
**Post date:** [November 26, 2015, 3:35am UTC](https://forums.unrealengine.com/t/unreal-js/48058/15 "2015-11-26T03:35:19Z")

</div>

That’s so cool! Thanks, nako\_sung!

I’m working on the android port, so far so good.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_089fe201](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_089fe201](https://forums.unrealengine.com/u/anonymous_user_089fe201)\
**Post date:** [November 26, 2015, 7:53am UTC](https://forums.unrealengine.com/t/unreal-js/48058/16 "2015-11-26T07:53:58Z")

</div>

@mflux - Currently javascript generated class has limited life time(created at runtime), it isn’t visible to blueprint. But you can expose JS functions by overriding pre-existing blueprint class. I think this will work for your case.

---

<div class="post-metadata">

**Author:** ![mflux](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mflux](https://forums.unrealengine.com/u/mflux)\
**Post date:** [November 26, 2015, 10:33am UTC](https://forums.unrealengine.com/t/unreal-js/48058/17 "2015-11-26T10:33:34Z")

</div>

, yep! I’ve done exactly that.

1. I created a blueprint that has variables for vertices, triangles, normals, uvs, and sends it to a procedural mesh
2. I extended this BP class in Javascript, and replaced the base-class’s vertices/faces etc with values generated from THREE.js
3. And finally I have a V8 instance BP running in the level

The BP

 ![meshgraph.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/2/025f082411d342fbdbaf66265e72642e20084809.png)

The JS code

```auto

    // Blueprint class can be subclassed!    
    class ProceduralJSMesh extends Blueprint.Load('/Game/ProceduralBox').GeneratedClass {
        // constructor
        ctor() {
            // Subobject initialization, property initialization 
            this.bAlwaysRelevant = true
            console.log( 'constructing procedural js mesh' );
        }
        
        // declare UPROPERTY's here
        // ; this.XXXXX/*[attribute+]+type*/;
        properties() {                                    
        }    
        
        ReceiveBeginPlay() {                                                                
            
            const geo = new THREE.BoxGeometry( 200, 200, 200, 1, 1, 1 );                        
            
            this.vertices = geo.faces.reduce( function( arr, f ){         
                arr.push( threeVertexToUEVertex( geo.vertices f.a ] ) );
                arr.push( threeVertexToUEVertex( geo.vertices f.b ] ) );
                arr.push( threeVertexToUEVertex( geo.vertices f.c ] ) );                
                return arr;
            }, ] );
            
            this.triangles = geo.faces.reduce( function( arr, f ){
                arr.push( f.a );
                arr.push( f.b );
                arr.push( f.c );                               
                return arr;
            }, ] );
            
            this.normals = geo.faces.reduce( function( arr, f ){                     
                arr.push( threeVertexToUEVertex( f.vertexNormals 0 ] ) );
                arr.push( threeVertexToUEVertex( f.vertexNormals 1 ] ) );
                arr.push( threeVertexToUEVertex( f.vertexNormals 2 ] ) );                    
                return arr;
            }, ] );
            
            this.uvs = geo.faceVertexUvs[0].reduce( function( arr, uvs ){                
                arr.push({
                    X: uvs[2].x,
                    Y: uvs[2].y
                });                
                return arr;                
            }, ] );
       
            super.ReceiveBeginPlay();
            
            console.log( 'vertices length', this.vertices.length );
            console.log( 'triangles length', this.triangles.length );
            console.log( 'normals length', this.normals.length );                                                  
        }     

```

The result:

 ![generatedcube.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/f/8/f82e97f78250a8a1bf892ccbc6aef58faca31a13.png)

Damnit 🙂 I’m so close. The winding ordering for faces is wrong, but I’ve tried for a few hours to fix this by flipping the vertices around with no success.

Anyway, this has a lot of promise, gonna keep going.

---

<div class="post-metadata">

**Author:** ![Konflict](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/konflict/32/906588_2.png) [@Konflict](https://forums.unrealengine.com/u/Konflict)\
**Post date:** [November 28, 2015, 1:37am UTC](https://forums.unrealengine.com/t/unreal-js/48058/18 "2015-11-28T01:37:40Z")

</div>

I’ve been following this topic for some days, cool thing Unreal JS is 🙂  
As per the latest additions by (check github!) the asset references can be resolved easily by just adding the class in the properties:

 ![asset_ref.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/f/6/f6016a04e9ceadf018ece242351cfb48bf79648e.jpeg)

this will help the cooking process to keep the references and also provides a simple access which is cool!

What i am missing is the ability to include the \*.js files in the PAK. I unfortunately only got the script being executed if i copy them to the cooked folder:

 ![package.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/4/0/407c56578bc6d3f4008ff048c0a9255b6ff95088.jpeg)

Including the scripts into the PAK does not work, or did i just messed up something here? 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_089fe201](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_089fe201](https://forums.unrealengine.com/u/anonymous_user_089fe201)\
**Post date:** [November 29, 2015, 5:53am UTC](https://forums.unrealengine.com/t/unreal-js/48058/19 "2015-11-29T05:53:12Z")

</div>

I’ll investigate it. 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d441f24f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d441f24f](https://forums.unrealengine.com/u/anonymous_user_d441f24f)\
**Post date:** [November 29, 2015, 6:23am UTC](https://forums.unrealengine.com/t/unreal-js/48058/20 "2015-11-29T06:23:05Z")

</div>

IntelliSense error

 ![HX1AN%[Z4UW`NVW)M%B8]Z6.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/1/e/11ef138f3e173a87ab071ec36b6cc9fc9495413e.png)  
IntelliSense error，How to VS 2013 Use The Unreal.js IntelliSense？

[Next page](https://forums.unrealengine.com/t/unreal-js/48058.md?page=2)
