Open Hannessa opened 4 years ago
I have the same problem when running UnrealjsDemo example maps in "Play - Standalone Game" in the Editor.
I modified the Engine\Plugins\Marketplace\UnrealJS\UnrealJS.uplugin and changed each of the "Modules" "Type" from "Editor" to "Runtime". I have not attempted to cook it yet, but I am able to get UnrealJS to run in the "Standalone Game". If someone could let me know if this works in a cooked build I'd appreciate that.
Thanks a lot for the info. I just tried this as well, and could run it in Standalone now, so definitely a progress.
However, when I tried to package it I first got some errors for the JavascriptGraphEditor, JavascriptEditor and JavascriptConsole modules, stating that it was "Unable to instantiate UnrealEd module for non-editor targets.". But after I changed the type to "Editor" for these three modules, and "Runtime" for the others I did not get those errors anymore. Unfortunately, I got a new error while packaging which was more cryptic, related to V8:
UATHelper: Packaging (Windows (64-bit)): ERROR: Missing precompiled manifest for 'V8'. This module was most likely not flagged for being included in a precompiled build - set 'PrecompileForTargets = PrecompileTargetsType.Any;' in V8.build.cs to override.
PackagingResults: Error: Missing precompiled manifest for 'V8'. This module was most likely not flagged for being included in a precompiled build - set 'PrecompileForTargets = PrecompileTargetsType.Any;' in V8.build.cs to override.
I don't really know what I need to change to make this error go away, so I'm stuck there now. Possibly something that needs to be changed in Engine\Plugins\Marketplace\UnrealJS\Source\V8\V8.Build.cs
So still has not successfully been able to run it in a packaged build.
I managed to package it now by copying the whole UnrealJS folder from Engine\Plugins\Marketplace\UnrealJS into [MyGame]\Plugins\UnrealJS Was inspired by this forum post: https://www.sidefx.com/forum/topic/62250/?page=1#post-277028
However, it still won't run my js-script in the packaged game :(
The log file when running the packaged version looks better than before, because I also see this line that wasn't there before:
[2020.08.18-14.54.21:021][ 0]JavascriptCmd: Unreal.js started. V8 7.7.299
However, my js-script just won't run (and won't show any error or appearance in the log file). Maybe the JavaScript Component that's in charge of running the script was not packaged correctly because I couldn't change all of the modules to "Runtime" in UnrealJS.uplugin? Standalone Play mode still works as expected from the Editor after this change, so it's just the packaged game that won't work correctly.
After several days of trying to figure a way around this, I have not. Thereby, I have to cease my unrealjs dependent project until this issue is fixed.... :(. Was cooking working with previous versions? Maybe I will downgrade.
I laid down for a second and thought about it for a moment and had a eureka moment. Add the UNREAL.JS plugin content folder
into the content folder of your project.
IT works for me!
I laid down for a second and thought about it for a moment and had a eureka moment. Add the UNREAL.JS plugin content folder into the content folder of your project.
IT works for me!
Wow! So it works in the packaged build for you now? It runs your javascript file?
I have already copied those files so unfortunately it doesn't make a difference for me.
Are you running the script using a JavaScript Component in your scene? I mean like this (this is my setup):
I just tried to create a new project from scratch, and did all of the steps from before, but still no js running in packaged build :(
What kind of template did you choose when setting up the Project? I used the following:
I finally have managed to get a script to run in packaged build as well!!
The key part for me was to create an empty C++ actor class and then build it in Visual Studio, after the other steps were done. Very important to not forget to build it: open the new actor class in Visual Studio and build it there (ctrl+shift+B).
I was a bit confused by the docs about creating a dummy c++ class: https://github.com/ncsoft/Unreal.js/wiki/Cooking
Non native project which doesn't have a single c++ class cannot be baked with game plugins. So if you have installed Unreal.js as a game plugin, you should switch your project into c++ project by adding a dummy native class.
I thought this step was only needed for Blueprint projects, to convert it to C++ project. But it was needed for my project as well, even though I started it as a C++ project. Maybe it can be clarified in the Wiki.
As a summary, what I needed to do was the following:
This should allow you to run in Play mode in the Editor and test if your script is working. To package the project, the following was also needed:
Now the project should be able to package and run as a packaged game.
Think the wiki needs revised with your post here... ;) cause the docs seem to be a bit confusing in a lot of places.
Hi!
I'm not able to get any js-script to run in a packaged build for Windows 64-bit in Unreal 4.25.3 using the Marketplace version of UnrealJS. I've tried both with and without "Use Pak File" in project settings, and also tried both Shipping and Development build.
I have added the Content/Scripts folder to "Additional Non-Assets to Copy/Package" in Project Settings as described in the wiki:
I also copied the files from Plugins\Marketplace\UnrealJS\Content\Scripts into Content/Scripts.
The script runs just fine within the Editor in normal Play mode. However, when I click "Play - Standalone Game" in the Editor, I get the same problem. I'm using the included JavaScript Component to run a start.js-file at game start.
I see no UnrealJS or JavaScript related warning in the build log. I have also checked the log-file when running the cooked build (located at [Game]/Saved/Logs/[Game].log) and I can see that UnrealJS is loaded without problems when the game is started:
LogPluginManager: Mounting plugin UnrealJS
I also see no error or warning related to UnrealJS or JavaScript in that log-file. Yet, the js-script just won't run. I have a console.log sent at the very top of my script, so expect to see at least that in the log-file, as well as drawing some UMG components, but I see nothing, as if the script doesn't even try to run in the packaged version.
I'm using a newly created C++ project, but don't have any custom C++ classes.
Am I doing something wrong?
Thanks!