I just have updated to support 4.15. (GitHub - ncsoft/Unreal.js-core: Unreal.js plugin submodule)
Great! Thanks, nako_sung. Is it coming to marketplace, or you’re too busy and we should just build it from source from now on?
I’m quite busy now. But next week I’ll be on a trip to GDC so I think there can be enough time to submit a build in a hotel room.
No pressure, and thanks =) Building from source is perfectly fine, it’s just a question of convenience for plugin users. Marketplace and auto-updates made programmers lazy
Is there a way to create a custom c++ class and have it call javascript functions. Is there a way to call custom methods inside the c++ class from javascript?
You can call all functions declared as UFUNCTION. (Reflection)
Thanks for the quick response. So how could I call a static javascript function from c++? How can I pass a reference to an object to javascript and have it call a method in javascript?
There are several example projects available on GitHub - ncsoft/Unreal.js-demo: Demo project for unreal.js. You can expose some WKO’s(well-known-objects are accessed with global var names) and you can keep your JS functions as unreal engine’s delegates to call back later.
Trying to return a variable to a blueprint from the javascript code
Hey There! Thanks for this plugin, its great! currently using it as part of my University Dissertation project
I’ve been trying to figure out how I can return a variable from JS to a blueprint. I can call the function fine but i cant get the variable to be passed back :S
I found the page on UPROPERTY on the wiki but even with the flags the value will not be passed back for osme reason, I’ve never used this flags before so Im sorry in advanced if this is such a rookie mistake
GetServerID(_posX/*int*/ , _posY/*int*/ , $/*return+int*/ ) {
console.log(GetServID(_posX, _posY)); //Prints correctly
console.log(typeof _posX); //Prints correctly
return _serverGrid[_posY][_posX].id/*return+int*/ ; //Returns 0 always, even with hard-coded value
}
Im using the plugin from the marketplace with version 4.14.3 of UE4.
Any help or hints is greatly appreciated!
You can declare a parent BP with function having proper signature and override that function with your JS class. Or you may leave return value to some member variable, so BP can read from it.
Good luck!
Updated build (4.15) is now online.
I really am enjoying the plugin so far, but I can’t seem to find any information on creating Enums. Or loading structs and enums that have been made in the editor , is this possible right now? Maybe I missed something in the example…
@marynate how to make projecet support android with Unreal.js plugin
You can create enum (someUEObj).CreateEnum(‘EnumName’,‘ABC’,‘DEF’,‘GHI’]).
Thanks for GitHub update to 4.16, nako_sung. Very minor thing: project files generator reports a warning. In JavascriptGraphEditor.Build.cs, line 7 should probably be
public JavascriptGraphEditor(ReadOnlyTargetRules Target) : base(Target)
instead of just
public JavascriptGraphEditor(ReadOnlyTargetRules Target)
Hi Everybody,
I’ve tried to use Three.js in “node_modules” directory but i don’t know what i have to include in the JS file to use it ? (npm xxx ?)
Could you help me please ?
@nako_sung
Hi,
I’m wondering about how you compiled a version of V8 that unreal can use? When I try to import the library for my own plugin it results in mismatch errors like this:
I notice unreal.js has four v8_base libs.
Say I have an class extending Actor in my js file, how do I reference that UClass in C++?
I get an error when trying to run any of the example scripts.
[FONT=courier new]Context.RunFile(“HelloCanvas.js”)
[FONT=courier new]< undefined
[FONT=courier new]Error: file:///c:/Code/UnrealJS/Content/Scripts/helloCanvas.js:8: ReferenceError: GWorld is not defined
[FONT=courier new]Error: ReferenceError: GWorld is not defined
[FONT=courier new]Error: at GetPC (file:///c:/Code/UnrealJS/Content/Scripts/helloCanvas.js:8:35)
[FONT=courier new]Error: at main (file:///c:/Code/UnrealJS/Content/Scripts/helloCanvas.js:13:9)
[FONT=courier new]Error: at process.nextTick (file:///c:/Code/UnrealJS/Content/Scripts/helloCanvas.js:56:46)
[FONT=courier new]Error: at invoke_next (file:///c:/Code/UnrealJS/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:14:9)
[FONT=courier new]Error: at Array.forEach (<anonymous>)
[FONT=courier new]Error: at Object.flushTicks (file:///c:/Code/UnrealJS/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:36:18)
[FONT=courier new]Error: at root (file:///c:/Code/UnrealJS/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:20:24)
I have downloaded the plugin source from git hub, placed it in my project’s Plugin folder and rebuilt when launching the project. The plugin shows up and the JavascriptConsole works.
Is there something simple that I’m missing?
*Solved: I realized that all of these scripts have to be run from within the Examples project. But it’s not so straight forward to get the unreal.js plugin built for a source version and then get the Examples project to work
Here’s what I did - maybe this will help someone else:*
- *Installed the unreal.js plugin from the marketplace under my binary version of UE4.17. *
- Started the binary version and built the plugin.
- Enabled the plugin and tried the JavaScript console (under Window->Developer Tools)
- Then copied the compiled engine plugin to my source version of UE4.17, and of course it wants to rebuild again.
- Enabled the plugin on my source engine.
- Git clone of the example project into a new folder.
- Deleted the Plugins folder in the example project, since I now already have the engine plugin work.
- Loaded the example project.
- Tested various maps - and they work!
console.log - not getting any output to the JavascriptConsole.
Where does the output go?
(see attached pic).