ncsoft / Unreal.js

Unreal.js: Javascript runtime built for UnrealEngine
Other
3.69k stars 351 forks source link
javascript plugin scripting unrealengine

Unreal.js

Unreal.js is a plug-in which brings V8-powered Javascript into UnrealEngine.

Installation

Features

Dummy demo

Tutorials & documentation

License

Examples

2048

Springy

Editor extension

Create a new actor

let myActor = new Actor(GWorld,{X:10,Y:20,Z:30});
myActor.SetActorLocation({X:40,Y:80,Z:120});

Subclass an existing class

class MyActor extends Actor {
  properties() {
    this.MyProp/*EditAnywhere+Replicated+int*/;
  }
  RPC(x/*int*/) /*Server+Reliable*/ {
    console.log('This function is replicated',this.MyProp++);
  }
}
let MyActor_C = require('uclass')()(global,MyActor);
if (GWorld.IsServer()) { 
  new MyActor_C(GWorld);
}

Node.js like

let _ = require('lodash');
let kick = () => {
  console.log("Hello timer!",_.keys(this));
  setTimeout(kick,1000);
};
kick();