Giter VIP home page Giter VIP logo

unreal.js's Introduction

Unreal.js

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

Installation

  • Search unreal.js on the epic marketplace
  • Manual installation
  1. git clone https://github.com/ncsoft/Unreal.js-core <YourProject>/Plugins/UnrealJS
  2. cd <YourProject>/Plugins/UnrealJS && ./install-v8-libs

Features

  • Powered by latest V8 (ES6)

  • CommonJS modules

  • Full access to the whole UnrealEngine API

  • Free to subclass existing classes including blueprint

  • Live reload

  • Communicate with outer world: REST(http), process(pipe), arraybuffer, ...

  • Bridge API for editor extension

  • Auto-completion for Visual Studio Code (auto-generated *.d.ts)

  • Debugging within Visual Studio, Visual Studio Code, WebStorm and all IDE which supports V8 protocol

  • Profiling supported by V8

  • Dedicated Javascript console on UnrealEditor

  • (Full) access to existing javascript libraries via npm, bower, ...

Dummy demo

Tutorials & documentation

License

  • Licensed under the BSD 3-Clause "New" or "Revised" License
  • see LICENSE for details

Examples

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();

unreal.js's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unreal.js's Issues

helloJade and helloUMG work in standalone but helloScope does not

I can see the UMG widgets for the helloScope example using PIE (play in editor) but when I launch that example using "Standalone Game" nothing appears. What's the difference between it and the other Jade/UMG examples? I'm guessing it's the devjade or devrequire scripts doing stuff only in the editor?

Submodule not fetching

I've never used git submodules before, so I might be doing something silly. Is "git submodule update" the correct way to pull from the core? When I try to pull or submodule update it fails. I think Unreal.js-core might be missing a push?

Thanks for your time.

git submodule update
error: no such remote ref bf353ebe2b72f5f5edda3232aed7323a92b618a7
Fetched in submodule path 'Plugins/UnrealJS', but it did not contain bf353ebe2b72f5f5edda3232aed7323a92b618a7. Direct fetching of that commit failed.

Recent commits prevent successful build of UnrealJS plugin

It seems that the merge and rollback commits on the 22nd March have broken things -- or at least I could not build the plugin using the latest version of the source and the v8 libs.

I found an older version last used on the 21st in another project of mine and it builds fine.

Here's the other issue where I list the steps to reproduce this problem and then solved it: #49 (comment)

Spiral generator not working

Spiral generator was working fine (in UE 4.10, a few weeks ago), but it seems to be broken in the latest release.

It gives me this error:

Error: ReferenceError: JavascriptEditorViewport is not defined ReferenceError: JavascriptEditorViewport is not defined
    at main (c:\Users\Arthur Masson\Documents\Unreal Projects\Unreal.js\Examples\Content\Scripts\extension-spiralGenerator.js:167:13)
    at create_inner (c:\Program Files (x86)\Epic Games\4.11\Engine\Plugins\UnrealJS\Content\Scripts\editor-maker.js:56:25)
    at c:\Program Files (x86)\Epic Games\4.11\Engine\Plugins\UnrealJS\Content\Scripts\editor-maker.js:82:13

I checked the difference between the old file and the new one, the problem seems to come from the replacement of jade by UMG.

Using Unreal.js for an editor plugin?

Unreal.js is awsome! That's why I would like to use it for a plugin based on an EdMode and an ModeToolkit.

I can think of two ways of doing it:

  • create the plugin in c++ (implementing the custom EdMode and ModeToolkit), create a project using this plugin and UnrealJS plugin, find a way to communicate between the c++ code and the javascript code,
  • extend the c++ code of UnrealJS to be able to create an EdMode and a ModeToolkit in javascript, and create the entire plugin in javascript,

The first solution seems more simple. How can I communicate from c++ to javascript? I would need to call some javascript code from c++, and the other way around (call c++ code from javascript).
(I would need to share objects among the two sides, but this should not be a problem)

FYI 2048 demo now broken

The demo worked with previous builds, but now I get the following error:

Error: c:\Users\Stew\Desktop\Unreal.js\Examples\Content\Scripts\2048\game\local_storage_manager.js:1: ReferenceError: window is not defined
Error: ReferenceError: window is not defined
Error:     at c:\Users\Stew\Desktop\Unreal.js\Examples\Content\Scripts\2048\game\local_storage_manager.js:1:1
Error:     at c:\Users\Stew\Desktop\Unreal.js\Examples\Content\Scripts\2048\game\local_storage_manager.js:67:25
Error:     at module.exports (c:\Users\Stew\Desktop\Unreal.js\Examples\Content\Scripts\2048\game\application.js:7:35)
Error:     at start_game (c:\Users\Stew\Desktop\Unreal.js\Examples\Content\Scripts\2048\index.js:48:53)
Error:     at module.exports (c:\Users\Stew\Desktop\Unreal.js\Examples\Content\Scripts\2048\index.js:55:9)
Error:     at c:\Users\Stew\Desktop\Unreal.js\Examples\Content\Scripts\hello2048.js:10:27
Error:     at invoke_next (c:/Users/Stew/Desktop/Unreal.js/Examples/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:14:9)
Error:     at Array.forEach (native)
Error:     at Object.target.process.flushTicks (c:/Users/Stew/Desktop/Unreal.js/Examples/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:36:18)
Error:     at root (c:/Users/Stew/Desktop/Unreal.js/Examples/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:20:24)
< Invalid script for require
Error: EXCEPTION TypeError: StorageManager is not a function TypeError: StorageManager is not a function
    at new GameManager (c:\Users\Stew\Desktop\Unreal.js\Examples\Content\Scripts\2048\game\game_manager.js:7:25)
    at module.exports (c:\Users\Stew\Desktop\Unreal.js\Examples\Content\Scripts\2048\game\application.js:11:20)
    at start_game (c:\Users\Stew\Desktop\Unreal.js\Examples\Content\Scripts\2048\index.js:48:53)
    at module.exports (c:\Users\Stew\Desktop\Unreal.js\Examples\Content\Scripts\2048\index.js:55:9)
    at c:\Users\Stew\Desktop\Unreal.js\Examples\Content\Scripts\hello2048.js:10:27
    at invoke_next (c:/Users/Stew/Desktop/Unreal.js/Examples/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:14:9)
    at Array.forEach (native)
    at Object.target.process.flushTicks (c:/Users/Stew/Desktop/Unreal.js/Examples/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:36:18)
    at root (c:/Users/Stew/Desktop/Unreal.js/Examples/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:20:24)

I'm guessing it's some module wanting a browser window object for localStorage?

How to actually get 'fs'?

Hey Nako

According to https://github.com/ncsoft/Unreal.js/wiki/Working-with-node.js-modules

"Only small amount of functions are provided including timer functions(setTimeout, clearTimeout, ...), process.nextTick and fs.readFileSync"

However upon trying this...

Error: c:\Users\Flux\Documents\Unreal Projects\CPCS\Content\Scripts\game\gamecore.js:1344: ReferenceError: readFileSync is not defined
Error: ReferenceError: readFileSync is not defined    

My code in question. This is transpiled by grunt-babel, not sure if that matters.

var fs = require('fs');
function load( filePath ){
  return fs.readFileSync( filePath, 'utf8').split(/\r?\n/);
}

Unable to package for win64

Hello. First off, thanks for making such a great plugin publicly available!

I'm currently having trouble packaging the Examples project to create a standalone win64 executable. I followed the directions for Building and have had no problems building after creating an empty c++ MyActor to make it a c++ project. The only other change I've made is changing the default map for the Game and Editor to HelloSpringy. Everything seems to run fine within the Editor, but when I try to package I get an "Error Unknown Cook Failure" (see attached PackageOutputLog.txt for the full output and PackageCookLog.txt).

If I select File -> "Cook Content for Windows" I get a successful cook (DebugCookLog.txt) and then am able to build and run Development Win64 with the Visual Studio 2015 Debugger.

Any help would be greatly appreciated!

PackageOutputLog.txt
PackageCookLog.txt
DebugCookLog.txt

Cannot read returned USTRUCT.

Function with return value which is type of USTRUCT doesn't give a valid return value, but function returns values as out ref works correctly.

Packaging

I followed the guide here: https://github.com/ncsoft/Unreal.js/wiki/Cooking

And I copied the Scripts directory from the UnrealJS plugin Content directory to the Content directory of my freshly packaged project.

When I tried to run this my project didn't work as expected (the JS wasn't running).

So then I changed the following line:

class MyPlayerController extends Blueprint.Load('/Game/ThirdPersonBP/Blueprints/RecoveryPlayerController').GeneratedClass {

to:

class MyPlayerController extends Root.ResolveClass('RecoveryPlayerController') {

But the JS still doesn't run. The project launches, I just don't see the result of my JS as I do when I launch from the editor.

Here's the Scripts directory of the built game containing all of the scripts from the plugin's Content/Scripts as well as the scripts from my project's Content/Scripts:

screenshot 2016-03-20 16 55 30

Any clues or corrections would be appreciated! :)

Crash when updating blueprint in an extension

I created an extension (extension-MyCustomExtension.js) which instanciate a Blueprint:

    class ABPJS extends Blueprint.Load('/Game/ABP').GeneratedClass {
        // constructor
        ctor() {
            // Subobject initialization, property initialization
            this.bAlwaysRelevant = true
        }
        // Overriding function doesn't need function signature
        ReceiveBeginPlay() {
            super.ReceiveBeginPlay()
            console.log("Hello, this is MyActor")
        }
    }

    let ABPJS_C = require('uclass')()(global,ABPJS)
    global.PB = new ABPJS_C(get_world(),{X:0})

the module destroy the actor when it exits:


module.exports = function () {
        main() // this creates the actor
    return _ => {
        global.PB.DestroyActor()
        get_world().EditorDestroyActor(global.PB)
    }
}

But when I modify the Blueprint (modify & compile in the Blueprint editor) and hit play, the editor crashes:

[2016.04.26-14.43.24:505][879]LogWorld:Warning: Found object to debug in main world that isn't the correct type
[2016.04.26-14.43.24:506][879]LogWorld:Warning:   TargetBP path is /Game/ABP.ABP
[2016.04.26-14.43.24:506][879]LogWorld:Warning:   TargetBP gen class path is /Game/ABP.ABP_C
[2016.04.26-14.43.24:506][879]LogWorld:Warning:   NewTargetObject path is /Temp/UEDPIE_0_Untitled_1.Untitled_1:PersistentLevel.ABPJS_C2_0
[2016.04.26-14.43.24:506][879]LogWorld:Warning:   NewTargetObject class path is /Script/Javascript.ABPJS_C2
[2016.04.26-14.43.24:507][879]LogWorld:Warning:   OldObject path is /Temp/Untitled_1.Untitled_1:PersistentLevel.ABPJS_C2_0
[2016.04.26-14.43.24:507][879]LogWorld:Warning:   OldObject class path is /Script/Javascript.ABPJS_C2
Ensure condition failed: false [File:D:\BuildFarm\buildmachine_++UE4+Release-4.11\Engine\Source\Runtime\Engine\Private\World.cpp] [Line: 1582] 
Failed to find an appropriate object to debug back in the editor world

OnlineSubsystem via Unreal.js

I followed the guide by Michael Allar on enabling Steam integration here: http://allarsblog.com/2016/02/26/BasicSteamIntegration/

And I now have a steam overlay in my game:
screenshot 2016-03-13 12 33 59

I would like to access the OnlineSubsystem from JS however it complains this doesn't exist.

So my guess is I have to follow the instructions from Allar's article under the section "Linking The OnlineSubsystemSteam Module" -- but then the Steam overlay works so this might be unnecessary.

Or maybe it's just that it's not possible to access OnlineSubsystem using Unreal.js yet?

Any clues would be appreciated :)

Adding Components

I have the following Character subclass:

  class MyCharacter extends Blueprint.Load('/Game/ThirdPersonCPP/Blueprints/ThirdPersonCharacter').GeneratedClass {
    ctor() {
      this.CollectionSphere = SphereComponent.CreateDefaultSubobject("CollectionSphere")
      this.CollectionSphere.SetSphereRadius(200)
      this.CollectionSphere.AttachParent = this.RootComponent
    }
    properties() {
      this.CollectionSphere/*VisibleAnywhere+Category:Javascript+CollectionSphere*/;
    }
  }

  let MyCharacter_C = require('uclass')()(global,MyCharacter)
  GWorld.GetGameMode().DefaultPawnClass = MyCharacter_C

This works fine in that I get the correct character running around, however the CollectionSphere doesn't seem to work correctly:

TypeError: this.CollectionSphere.SetSphereRadius is not a function

This is because this.CollectionSphere turns out to be a string and not a Component object (when I check using typeof or in the console if I set global.sphere = this.CollectionSphere in the ctor).

Is there a step I'm missing here?

Path problem in V8.Build.cs

I had to change

        PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "v8", "Includes"));

to

        PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "v8", "include"));

in V8.Build.cs to be able to compile. It works fine now!

UnrealJS failed to load because V8 could not be found

Hello! I've downloaded the pre-built V8 from releases. Placing it into:

C:\Program Files (x86)\Epic Games\4.10\Engine\Plugins\UnrealJS

Such that C:\Program Files (x86)\Epic Games\4.10\Engine\Plugins\UnrealJS\ThirdParty\v8 exists

However upon loading up UE4:

pluginfailed

Am I missing additional installation steps in order to boot up UE4 with this plugin?

How to use Huge Typed Array?

Hi Nako, I seem to be running into speed issues passing large arrays from JS into Unreal. The size range is between 3000 to 16000 floats, for passing geometry data from JS to Unreal.

I'm 99% sure the speed loss is due to JS transfering data and needs to use: https://github.com/ncsoft/Unreal.js/wiki/Huge-typed-array

However, I'm uncertain how to actually pass to for example, ProceduralMesh component's UpdateMeshSection function.

I'm comfortable enough with C++ do dive in however this is still confusing to me:

let ab = new ArrayBuffer(32*1024); // 32K bytes buffer
let u8 = new Uint8Array(ab); // typed array
memory.bind(ab);
GWorld.MySuperMemoryFunction();
memory.unbind(ab);

What is MySuperMemoryFunction()? Is this compiled from somewhere? How do you go about creating that function? Is 'ab' variable supposed to be passed in?

void UMyBlueprintFunctionLibrary::MySuperMemoryFunction(UWorld* World)
{
    auto size = FArrayBufferAccessor::GetSize();
    auto buffer = FArrayBufferAccessor::GetData();
}

Is there just a single FArrayBufferAccessor that's bound as a global variable? What's the best way to go from here to ProceduralMesh's UpdateMeshSection?

2048 Example errors

Console logs:

LogLinker: Warning: The file '../../../../../../Users/Flux/Documents/Unreal Projects/unrealjs 4.10/Content/Color.uasset' contains unrecognizable data, check that it is of the expected type.
LogLinker: Warning: The file '../../../../../../Users/Flux/Documents/Unreal Projects/unrealjs 4.10/Content/Color.uasset' contains unrecognizable data, check that it is of the expected type.
LogUObjectGlobals: Warning: Failed to find object 'Material /Game/Color.Color'
Error: TypeError: Cannot read property 'SetVectorParameterValue' of undefined
Error:     at Object.tile.set_color (C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:199:29)
Error:     at Object.tile.set_value (C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:128:26)
Error:     at Actuator.addTile (C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:269:21)
Error:     at C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:233:34
Error:     at Array.forEach (native)
Error:     at C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:231:28
Error:     at Array.forEach (native)
Error:     at C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:230:28
Error:     at C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\animframe_polyfill.js:10:17
Error:     at invoke_next (C:/Program Files (x86)/Epic Games/4.10/Engine/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:14:9)
Error: TypeError: Cannot read property 'SetVectorParameterValue' of undefined
Error:     at Object.tile.set_color (C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:199:29)
Error:     at Object.tile.set_value (C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:128:26)
Error:     at Actuator.addTile (C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:269:21)
Error:     at C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:233:34
Error:     at Array.forEach (native)
Error:     at C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:231:28
Error:     at Array.forEach (native)
Error:     at C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:230:28
Error:     at C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\animframe_polyfill.js:10:17
Error:     at invoke_next (C:/Program Files (x86)/Epic Games/4.10/Engine/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:14:9)
Error: TypeError: Cannot read property 'SetVectorParameterValue' of undefined
Error:     at Object.tile.set_color (C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:199:29)
Error:     at Object.tile.set_value (C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:128:26)
Error:     at Actuator.addTile (C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:269:21)
Error:     at C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:233:34
Error:     at Array.forEach (native)
Error:     at C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:231:28
Error:     at Array.forEach (native)
Error:     at C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\actuator.js:230:28
Error:     at C:\Users\Flux\Documents\Unreal Projects\unrealjs 4.10\Content\Scripts\2048\game\animframe_polyfill.js:10:17
Error:     at invoke_next (C:/Program Files (x86)/Epic Games/4.10/Engine/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:14:9)

2048screen

Error: TypeError: this.GetCapsuleComponent is not a function

Hello there, I have been trying to port third-person character over JS and found some weird issue.
I have created ThirdPersonExample class which extends Character, but as soon as I try to get capsule component it gives me an error:

Error: TypeError: this.GetCapsuleComponent is not a function

    function main()
    {
        // declare a new character class
        class ThirdPersonExample extends Character
        {
            // strange? ctor, not constructor...
            ctor()
            {
                // Set size for collision capsule
                this.GetCapsuleComponent().InitCapsuleSize(42.0, 96.0)

Maybe I'm doing something wrong?

Doesn't work in html5

Hey,

I enabled Unreal.js plugin and packed my project in html5 platform. Compilation has been finished fine but in runtime i got this error:

Plugin 'UnrealJS' failed to load because module 'JavascriptUMG' could not be found. Please ensure the plugin is properly installed, otherwise consider disabling the plugin for this project.

In log i found more errors:

[2016.04.10-22.09.06:755][ 0]LogInit: Selected Device Profile: [HTML5]
[2016.04.10-22.09.07:138][ 0]LogModuleManager:Warning: ModuleManager: Module 'JavascriptUMG' not found - its StaticallyLinkedModuleInitializers function is null.
[2016.04.10-22.09.07:138][ 0]LogModuleManager:Warning: ModuleManager: Module 'JavascriptHttp' not found - its StaticallyLinkedModuleInitializers function is null.
[2016.04.10-22.09.07:139][ 0]LogModuleManager:Warning: ModuleManager: Module 'JavascriptWebSocket' not found - its StaticallyLinkedModuleInitializers function is null.

How do method params get converted to Unreal objects?

The plugin I'm using has a function as follows:

UTexture2D * UAdvancedFriendsLibrary::GetSteamFriendAvatar(APlayerController *PlayerController, const FBPUniqueNetId UniqueNetId, SteamAvatarSize AvatarSize)

I'm able to successfully call this as:

let texture = AdvancedFriendsLibrary.GetSteamFriendAvatar(PC, friend.UniqueNetId, SteamAvatarSize.SteamAvatar_Large)

So I've worked out how to translate C++ into JS to do things like the above.

My question is how do method params get converted into Unreal/C++ objects, and more specifically, how can I cast JS objects to be their proper C++ type and have the same properties and methods?

What follows is a specific example.

I see later in that above function in C++ it has:

uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());

However my friend.UniqueNetId doesn't have a UniqueNetId property or GetBytes() method.

So I'm assuming that Unreal.js does some magic and converts the JS object I'm passing as a param to an instance of the appropriate class before handing it to C++ yes?

Is there a way that I can do this manually myself outside of that function if I want to get this same uint64 id? I've tried creating new BPUniqueNetId() variables in JS with no luck, but I reckon I'm not doing it correctly.

As far as I understand, this BPUniqueNetId is a variant of FUniqueNetIdString found here: https://docs.unrealengine.com/latest/INT/API/Runtime/OnlineSubsystem/FUniqueNetIdString/index.html
or maybe: https://docs.unrealengine.com/latest/INT/API/Runtime/OnlineSubsystem/FUniqueNetId/index.html

This is less a Steam-specific question and more a question of how do I correctly create objects using JS to match their C++ counterparts. There are some hints in your example demos such as PlayerController.C(PC).bShowMouseCursor = true and PlayerController.C(PC).SetInputMode_GameAndUI(widget,false,false) which I assume means "cast PC to be a PlayerController and set a property or call a method as that class" -- however I'm stuck with the example above regarding creating a proper UniqueNetId instance (and its property of the same name) that I can then call GetBytes() on.

Issues while opening JavascriptPlayground project

When i try to open JavascriptPlayground.uproject after i did what install&play instruction tells me, i get these error messages in JavascriptConsole:
LogLinker: Warning: The file 'D:/dev/apps/Unreal.js/Examples/Content/Color.uasset' contains unrecognizable data, check that it is of the expected type. LogLinker: Warning: The file 'D:/dev/apps/Unreal.js/Examples/Content/Color.uasset' contains unrecognizable data, check that it is of the expected type. LogUObjectGlobals: Warning: Failed to find object 'Material /Game/Color.Color' Error: d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\instantiator.js:170: TypeError: Cannot read property 'GetEditorWorld' of undefined Error: TypeError: Cannot read property 'GetEditorWorld' of undefined Error: at d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\instantiator.js:170:48 Error: at d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\instantiator.js:408:3 Error: at d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\instantiator.js:410:25 Error: at d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\UMG.js:7:24 Error: at d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\UMG.js:674:3 Error: at d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\UMG.js:676:25 Error: at d:\dev\apps\Unreal.js\Examples\Content\Scripts\extension-spiralGenerator.js:9:12 Error: at d:\dev\apps\Unreal.js\Examples\Content\Scripts\extension-spiralGenerator.js:117:3 Error: at d:\dev\apps\Unreal.js\Examples\Content\Scripts\extension-spiralGenerator.js:118:25 Error: at spawn (d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\editor.js:28:12) < Invalid script for require Error: d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\UMG.js:8: TypeError: Cannot read property 'conv' of undefined Error: TypeError: Cannot read property 'conv' of undefined Error: at d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\UMG.js:8:28 Error: at d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\UMG.js:674:3 Error: at d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\UMG.js:676:25 Error: at d:\dev\apps\Unreal.js\Examples\Content\Scripts\extension-spiralGenerator.js:9:12 Error: at d:\dev\apps\Unreal.js\Examples\Content\Scripts\extension-spiralGenerator.js:117:3 Error: at d:\dev\apps\Unreal.js\Examples\Content\Scripts\extension-spiralGenerator.js:118:25 Error: at spawn (d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\editor.js:28:12) Error: at d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\editor.js:39:40 Error: at Array.map (native) Error: at main (d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\editor.js:39:26) < Invalid script for require Error: d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\jade-umg.js:115: TypeError: Cannot read property 'text' of undefined Error: TypeError: Cannot read property 'text' of undefined Error: at tag (d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\jade-umg.js:115:20) Error: at d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\jade-umg.js:132:28 Error: at Array.map (native) Error: at block (d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\jade-umg.js:130:40) Error: at tag (d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\jade-umg.js:109:28) Error: at d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\jade-umg.js:132:28 Error: at Array.map (native) Error: at block (d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\jade-umg.js:130:40) Error: at tag (d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\jade-umg.js:109:28) Error: at d:\dev\apps\Unreal.js\Examples\Plugins\UnrealJS\Content\Scripts\jade-umg.js:132:28 < Invalid script for require Error: TypeError: require(...) is not a function

And no one assets not visible in UE Editor. What i did wrong?

Get error while clone Unreal.js

This error show up while I git clone the Unreal.js after i install the git lfs.

Errors logged to .git\lfs\objects\logs\20160115T110318.1333857.log
Use `git lfs logs last` to view the log.
error: external filter git-lfs smudge %f failed 2
error: external filter git-lfs smudge %f failed
fatal: Examples/Content/Color.uasset: smudge filter lfs failed
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

Here is the log.

git-lfs/1.1.0 (GitHub; windows amd64; go 1.5.1; git 258acf1)
git version 2.6.2.windows.1

$ git-lfs.exe smudge Examples/Content/Color.uasset
Error accessing media: Examples/Content/Color.uasset (5a233fcda4b0f4aa646433482c11f199441353bd522a22c3f59cc954a5d3c81f)

Get https://github-cloud.s3.amazonaws.com/alambic/media/119375739/5a/23/5a233fcda4b0f4aa646433482c11f199441353bd522a22c3f59cc954a5d3c81f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIMWPLRQEC4XCWWPA%2F20160115%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20160115T030309Z&X-Amz-Expires=86400&X-Amz-Signature=2dab28b64145d6f8b4779779c4ae118b9ac0cc4d1adae536d857a8696f7b8c5b&X-Amz-SignedHeaders=host&actor_id=0&token=1: net/http: TLS handshake timeout
goroutine 1 [running]:
github.com/github/git-lfs/lfs.Stack(0x0, 0x0, 0x0)
    C:/Users/techn/go/src/github.com/github/git-lfs/lfs/errors.go:557 +0x87
github.com/github/git-lfs/commands.logPanicToWriter(0x3041e8, 0xc08215c018, 0x2a60968, 0xc082169460)
    C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:184 +0xf86
github.com/github/git-lfs/commands.logPanic(0x2a60968, 0xc082169460, 0x0, 0x0)
    C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:148 +0x428
github.com/github/git-lfs/commands.handlePanic(0x2a60968, 0xc082169460, 0x0, 0x0)
    C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:123 +0x55
github.com/github/git-lfs/commands.LoggedError(0x2a60968, 0xc082169460, 0x967a80, 0x1e, 0xc08206bc78, 0x2, 0x2)
    C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:73 +0x89
github.com/github/git-lfs/commands.smudgeCommand(0xb67f60, 0xc082009a70, 0x1, 0x1)
    C:/Users/techn/go/src/github.com/github/git-lfs/commands/command_smudge.go:77 +0xd90
github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra.(*Command).execute(0xb67f60, 0xc0820099c0, 0x1, 0x1, 0x0, 0x0)
    C:/Users/techn/go/src/github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra/command.go:477 +0x40a
github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra.(*Command).Execute(0xb68fa0, 0x0, 0x0)
    C:/Users/techn/go/src/github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra/command.go:551 +0x59a
github.com/github/git-lfs/commands.Run()
    C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:88 +0x2a
main.main()
    C:/Users/techn/go/src/github.com/github/git-lfs/git-lfs.go:34 +0x135

ENV:
LocalWorkingDir=.
LocalGitDir=.git
LocalGitStorageDir=.git
LocalMediaDir=.git\lfs\objects
TempDir=.git\lfs\tmp
ConcurrentTransfers=3
BatchTransfer=true
GIT_ASKPASS=D:\Program Files\TortoiseGit\bin\SshAskPass.exe
GIT_DIR=.git
GIT_SSH=D:\Program Files\TortoiseGit\bin\TortoiseGitPlink.exe
GIT_WORK_TREE=.

How can i fix it?

UObject.Find is not a function

Hi Nako, I've updated to the latest version and encountered this problem:

Error: TypeError: UObject.Find is not a function
Error:     at register (C:\Program Files (x86)\Epic Games\4.10\Engine\Plugins\UnrealJS\Content\Scripts\uclass.js:57:30)
Error:     at compile (C:/Users/Flux/Documents/Unreal Projects/CPCS/Content/Scripts/cpcsruntime.js:10:20)

UnrealJS exists here: C:\Program Files (x86)\Epic Games\4.10\Engine\Plugins\UnrealJS

Which I've unzipped from UnrealJS.Prebuilt.4.10.1-20160106-1

The line from which eventually reaches that is:

function compile( cl ){
  return uclass()( global, cl );
}

Which I've copied from one of your examples.

Base class isn't determined correctly

Base class isn't determined correctly.

let ABC = StaticMeshActor;
class MyActor extends ABC {}

Code above will complain there is no such a class. This issue has been fixed but not yet released.

runtime eval/compile

So tried this out the other day, really awesome work!

Live reload works in the editor, but if you run standalone/packaged it won't which makes sense.
My question is if there is a function or method you can call to reload and re-evaluate a javascript file in standalone/packaged games?

4.11?

What would it take to get this working with 4.11? I think I may just need the binaries.

Breakpoints not working when debugging with Visual Studio 2015 or Visual Studio Code

I managed to attach the NTVS debugger to localhost:5858. It seems to be working since the javascript console (in UE) says

< V8 Debugger session start

and

< V8 Debugger session stop 

but breakpoints do not work in Visual Studio, it says

the breakpoint will not currently be hit. no code has been loaded for this code location

and the debugger; keyword (in JS code) does not work.

Having trouble with installation instructions..

Hi, the setup instructions are giving me some issues..

Install git-lfs first to download *.umap, *.uasset properly. (https://git-lfs.github.com/)

I would suggest saying that you need to run git lfs fetch, this is hard to figure out if someone hasn't used git lfs before.

Download prebuilt UnrealJS plugin and unzip into Playground/Plugins/UnrealJS.

Where do you find this download, and where is the Playground/ directory? (I'm guessing that the Unreal.js repo should be cloned with the name Playground?)

cd .../Content/Scripts && npm i to install node.js packages.

Is this supposed to be inside /Plugins/UnrealJS/Content/Scripts or inside /Examples/Content/Scripts ?

The command npm i doesn't work when inside /Plugins/UnrealJS/Content/Scripts because there is no package.json file there. But it looks like node_modules is already there so npm i is not necessary.

Activate JavascriptConsole by clicking Windows - Developer Tools - JavascriptConsole.

When I try, the JavascriptConsole does not show up in that menu. I'm guessing that I missed one of the setup steps..

Anyway thanks for making this cool project open source!

iOS support? Planned?

Sorry if it was already answered but I couldn't find it.

As far as I know Apple does not allow iOS apps to run custom V8 vms. Instead all apps must use Apple's JavascriptCore runtime. This is for example what react native does.

I couldn't see any references to JavascriptCore in Unreal.js, so I assume it won't work for iOS.

Do you plan to add support for it in the future?

In UE4.10.4 2048 example run fail.

full log : https://gist.github.com/damody/a69db626e34709c72edd

Error: EXCEPTION TypeError: Cannot read property 'scope' of undefined TypeError: Cannot read property 'scope' of undefined
    at set_attrs (j:\C++\UnrealEngine-4.10.4-release\Engine\Plugins\UnrealJS\Content\Scripts\instantiator.js:239:40)
    at module.exports (j:\Unreal Projects\Unreal.js\Examples\Content\Scripts\2048\game\actuator.js:15:9)
    at module.exports (j:\Unreal Projects\Unreal.js\Examples\Content\Scripts\2048\game\application.js:6:45)
    at start_game (j:\Unreal Projects\Unreal.js\Examples\Content\Scripts\2048\index.js:48:53)
    at module.exports (j:\Unreal Projects\Unreal.js\Examples\Content\Scripts\2048\index.js:55:9)
    at j:\Unreal Projects\Unreal.js\Examples\Content\Scripts\hello2048.js:10:27
    at invoke_next (j:/C++/UnrealEngine-4.10.4-release/Engine/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:14:9)
    at Array.forEach (native)
    at Object.target.process.flushTicks (j:/C++/UnrealEngine-4.10.4-release/Engine/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:36:18)
    at root (j:/C++/UnrealEngine-4.10.4-release/Engine/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:20:24)

no problem for another examples.

I install node.js 5.7.0.

How to use the ReplicatedUsing UPROPERTY

I'm getting the following warning in the console:

LogRep: Warning: FRepLayout::CallRepNotifies: Can't find RepNotify function OnRepHealth for property health on object MyCharacter_C1_5.

Here's the associated code:

class MyCharacter extends Blueprint.Load('/Game/ThirdPersonBP/Blueprints/ThirdPersonCharacter').GeneratedClass {
    prector() {
      MyCMC_C.SetDefaultSubobjectClass("CharMoveComp")
    }
    ReceiveTick(DeltaTime) {
      this.health++
      this.TextRender.SetText(this.GetName() + "\n" + this.Role + "\n" + this.GetMovementComponent().Mass)
    }
    OnRepHealth(h) {
      console.log('health replicated', this.health)
    }
    properties() {
      this.health/*EditAnywhere+ReplicatedUsing:OnRepHealth+int*/;
    }
  }

I followed the example here: https://github.com/ncsoft/Unreal.js/wiki/UPROPERTY

I tried OnRepHealth() (without the h param) and it still gave the warning. Am I not declaring the function correctly?

Missing package.json

So in UnrealJS/Content/Scripts we're supposed to npm i to install the node modules or at least update them. However that's currently not possible as it's looking for a package.json that may have been left out of the commit.

[question] OS X support

Are you planning OS X or Unix support?

P.S. Great work! This plugin looks very promising.

Input Binding example broken

helloInputBinding.js:38: TypeError: Cannot set property 'PlayerControllerClass' of undefined

I'm guessing line 38 should read:

Root.GetOuter().PlayerControllerClass = MyPC_C

Accessing BP callbacks in JS

I have the following setup in BP that works:
screenshot 2016-03-16 16 48 08

I'm attempting to perform the same operation in JS in my PlayerController subclass:

        getSteamFriends() {
            let PC = this
            let friendsProxy = GetFriendsCallbackProxy.GetAndStoreFriendsList(GWorld, PC)
            friendsProxy.Activate()
            let friends = PC.GetStoredFriendsList().FriendsList
//             let friends = [];
//             AdvancedFriendsLibrary.GetStoredFriendsList(PC, friends)
            return friends
        }

The C++ class definition is as follows:

UCLASS(MinimalAPI)
class UGetFriendsCallbackProxy : public UOnlineBlueprintCallProxyBase
{
    GENERATED_UCLASS_BODY()

    // Called when the friends list successfully was retrieved
    UPROPERTY(BlueprintAssignable)
    FBlueprintGetFriendsListDelegate OnSuccess;

    // Called when there was an error retrieving the friends list
    UPROPERTY(BlueprintAssignable)
    FBlueprintGetFriendsListDelegate OnFailure;

    // Gets the players list of friends from the OnlineSubsystem and returns it, can be retrieved later with GetStoredFriendsList
    UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedFriends")
    static UGetFriendsCallbackProxy* GetAndStoreFriendsList(UObject* WorldContextObject, class APlayerController* PlayerController);

    virtual void Activate() override;

If I delete the SteamFriends variable and the BP code then the JS does not work, so my understanding is that in JS I have to emulate the "OnSuccess" Exec from the BP in order for the subsquent GetStoredFriendsList to work.

I can see that the class has a BluePrintGetFriendsListDelegate OnSuccess but I'm not sure how to to use that. Is it like a callback in JS?

Node modules

I installed Math.js from http://mathjs.org/ in Content/Scripts however when I loaded my project into Unreal, Unreal detected the new files and mistakenly thought I was trying to import a data table, see:

https://www.dropbox.com/s/iwhdw1vxtag9g73/Screenshot%202016-02-11%2002.46.23.png?dl=0&preview=Screenshot+2016-02-11+02.46.23.png

Apart from that, trying to use the library like so:

let math = require('mathjs')
console.log(math.sqrt(4))

Resulted in an "Invalid script for require" error in the console, see:

https://www.dropbox.com/s/czojbpbn1furxse/Screenshot%202016-02-11%2002.48.47.png?dl=0&preview=Screenshot+2016-02-11+02.48.47.png

I also tried installing the Node module in Plugins/UnrealJS/Content/Scripts with no success.

Is there a special way/place to install/require modules that aren't included with Unreal.js by default?

widget randomly dies

I have the following code:

Near the start of my game.js

  //let widgetClass = Blueprint.Load('/Game/HUDWidget').GeneratedClass 
  let widgetClass = Root.ResolveClass('HUDWidget') 

In my PlayerController class

    ReceiveBeginPlay() {
      this.widget = GWorld.CreateWidget(widgetClass, this)
      if (!this.widget.IsInViewport()) this.widget.AddToViewport()
      //global.widget = this.widget
    }

In the ReceiveTick function of my PlayerController

      this.widget.SprintBar.SetPercent(this.sprintTimeLeft / this.sprintTime)

That last line above throws errors after I play my game for a little while, see near end of this video:

https://www.youtube.com/watch?v=Fl8zW9CxPF8

Basically the widget becomes undefined. Any idea why? Do widgets have a lifespan or heartbeat that you need to keep calling in order to keep them "alive"?

Replication (or TextRender component) in JS not working the same as in BP

I followed this official tutorial about replication -- https://www.youtube.com/watch?v=htdI2dh-aek -- and implemented things up to the 17 minute mark, with success:

bp

When I tried to implement the same logic in JS however things do not work the same:

js

Here is my JS code which I believe has the same logic as the tutorial uses for BP:

(function (global) {
  "use strict"

  class MyCharacter extends Blueprint.Load('/Game/ThirdPersonBP/Blueprints/ThirdPersonCharacter').GeneratedClass {
      ctor() {
        this.maxHealth = 100
        this.maxBombCount = 3
      }
      ReceiveBeginPlay(DeltaTime) {
        //if (this.Role == 'ROLE_Authority') {
        if (this.HasAuthority()) {
          this.InitAttributes()
        }
      }
      InitAttributes() {
        if (this.HasAuthority()) {
          this.InitHealth();
          this.InitBombs();
        }
      }
      InitHealth() {
        this.health = this.maxHealth
        console.log('health updated by', this.Role)
      }
      InitBombs() {
        this.bombCount = this.maxBombCount
        console.log('bombCount updated by', this.Role)
      }
      UpdateCharacterDisplayText() {
        let text = 'Health: ' + this.health + ' Bombs: ' + this.bombCount
        this.TextRender.SetText(text)
        console.log('text updated by', this.Role, '=', text)
      }
      OnRepHealth()/*Any*/ {
        this.UpdateCharacterDisplayText()
      }
      OnRepBombCount()/*Any*/ {
        this.UpdateCharacterDisplayText()
      }
      properties() {
        this.health/*ReplicatedUsing:OnRepHealth+float*/; // not usually RepNotify but is for the TextRender
        this.maxHealth/*float*/;
        this.bombCount/*ReplicatedUsing:OnRepBombCount+int*/;
        this.maxBombCount/*int*/;
      }
  }
  let MyCharacter_C = require('uclass')()(global,MyCharacter)
  Root.GetOuter().DefaultPawnClass = MyCharacter_C

  function main() {
    return function() {}
  }

  try {
    module.exports = () => {
      let cleanup = null
      cleanup = main();
      return () => cleanup()
    }
  }
  catch (e) {
    require('bootstrap')('game')
  }
})(this)

You can see the console output in the screenshot above is correctly updating the health and bombCount only on the server, and changing the text render component on the client, and this text value is correctly set to "Health: 100 Bombs: 3" however the text render component on the server is not changing.

My only guess is `this.TextRender.SetText(text)' is not the right way to grab the text render component and set it?

require(..) is not a function

I am trying to build a tool to connect to a socket.io server from within UE4. I have been running into problems trying to add socket.io-client as a dependency. I have written a small test script to try and use socket.io-client and every time I try I get a lot of errors where the system will not allow socket.io-client to require any of its own dependencies.

To reproduce:
Create a js script with the following code:

(function (global){
    "use strict";

    const io = require('socket.io-client');

    const socketURL = 'http://10.10.0.82:8000';
    let socket = io.connect(socketURL);

    socket.on('hello', function (){
        console.log("Socket Connected!!")
    });
})(this);

Save it into your scripts folder, then do npm i --save socket.io-client in the scripts folder.

Open a blank project, add an actor, and add a javascript component with the script source file pointing to the js script you created.

Add the plugin to the project folder and the v8 engine and the file links as shown on the project page.

I have been trying to troubleshoot more and so i added this as a script into the Examples directory and am able to use lodash but still can not use Socket.io-client.

Any help would be really appreciated!

Adding to Arrays

It wasn't clear from the documentation, as well as reading the source.

Creating a new property array looks like:

    properties() {
        this.vertices/*Vector[]*/;    
        this.triangles/*int[]*/;
    }    

However doing none of the following worked:

        this.vertices.add({X:0,Y:0,Z:0});
        this.vertices.Add({X:0,Y:0,Z:0});

        this.vertices = [];
        this.vertices.push({X:0,Y:0,Z:0});

A few questions

  • What's the proper way to instantiate an array? How do you modify the array?
  • Do properties overwrite inherited properties? For example if this class's baseclass already has a vertices array made from a blueprint, does this reference the underlying class' vertices array? Or is it creating a new one?

Crash on delegate gc'd

repro

  1. bind a delegate into widgets which is passed to tab spawner.
  2. obj gc on console command
  3. wait for crash

Sample project not loading

It seems like everything is installed correctly. I see a Javascript console, and can define variables inside and use them.

However the sample project that loads is empty. There are no Scripts within the content browser (not sure if that's expected?)

GWorld is inaccessible as well, see screenshot

not sure if installed

Upon trying to rebuild the sample project from its visual studio solution:
cantfindmodule

So a few questions

  1. How do I ensure, from the JavascriptPlayground, that the sample and plugin is loaded correctly?
  2. How do I run the actual Javascript code from within the JavascriptPlayground UE4 project?

Missing declaration of "UClass" and "GWorld"

I tried to use Unreal.js with TypeScript, then some declaration missing error occurred.

  • UnrealJS.Prebuilt.4.11.0-20160401-1.zip
  • TypeScript 1.8.7

Is that like a following definition not necessary?

declare class UClass{}
declare var GWorld:World;

Extending blueprint functions + arguments will crash UE4

To reproduce:

  1. Open HelloBlueprint
  2. Open ExampleBlueprint
  3. Give CustomEvent a new Input (any type) like so:

screenshot 2016-03-03 18 30 43

  1. Run the game
  2. UE4 crashes

This happens whenever you give a function you're overriding an argument.

    // Override an event which was declared in Blueprint
    CustomEvent() {
        console.log("This is javascript")
    }

Actually giving it an argument in JS

    // with or without signature
    CustomEvent(newParam/*string*/) { 
        console.log("This is javascript")
    }

Will still result in a crash.

Because of this, events such as key presses, button clicks from UMG, etc cannot pass in relevant data to JS.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.