Announcement

Collapse
No announcement yet.

FREE: Web UI (HTML/CSS/JS Interface)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • started a topic FREE: Web UI (HTML/CSS/JS Interface)

    FREE: Web UI (HTML/CSS/JS Interface)


    The WebUI plugin allows developers to create rich web-based user interfaces using blueprints. It's powered by the native UnrealCEFSubProcess built into the engine and includes support for Windows, Mac, Linux, Android (4.19+) and iOS (4.21+). This plugin also includes a robust JSON library that provides integrated management of objects, arrays, and primitive data types. It comes with an example project that demonstrates a startup map with a volume slider and FPS counter. This plugin includes multiplayer support by removing the CEF in dedicated server builds without changing any blueprint classes.







    You must have a GitHub account linked to your Epic Games account! Otherwise you will receive the following 404 error if you are not signed in with a linked account.

    Setup Instructions: unrealengine.com/ue4-on-github



    Frequently Asked Questions

    Can I use this plugin for off-screen compositing?

    Yes, there's a couple options depending on what functionality you require. The internal rendering of the WebInterface widget can't be accessed in blueprints so there isn't an easy way to directly reference a texture. However you can use a URetainerBox to apply a post process material using a texture parameter or add a UWidgetComponent to your blueprint which renders the widget to a render target texture.

    Can I put the interface on 3D objects in the world?

    Yes, if you use a URetainerBox it provides a texture parameter to an effect material which you can reference at runtime using GetEffectMaterial. This dynamic material instance can be applied to a UMeshComponent using SetMaterial. Another option is to use a UWidgetComponent as a wrapper because essentially it's only purpose is to provide access to a render target texture. If the component isn't visible you can still use the GetRenderTarget function to obtain a Texture2D reference. These textures can also be applied to a UMeshComponent using CreateDynamicMaterialInstance and SetTextureParameterValue.

    What kind of performance can I expect?

    The WebInterface widget runs on the same UnrealCEFSubProcess as the WebBrowser widget. It just adds the ability to transmit JSON to the engine from JavaScript, but you can already send JavaScript to the browser from the engine. That means you can test the performance by enabling the WebBrowser plugin that comes with the engine and try experimenting with that beforehand.

    Do you have any tips to improve performance?

    Yes, but please note that the CEF can already meet the needs of most games unless the UI needs to be an integral component of the gameplay. Some performance tips for now would be to utilize a transparent background to reduce the size of paint regions. You can also disable frame buffering by unsetting USE_BUFFERED_VIDEO. Another option is to manually set the subprocess frame rate in your engine source code.

    Are there any third-party dependencies in this plugin?

    No, the Web UI plugin does not have any third-party dependencies at this time. It uses the native UnrealCEFSubProcess built into the engine which runs on the Chromium Embedded Framework. This is already included for Windows and Mac with all versions of UE4 since 4.8 and 4.15 added Linux support. While the plugin is not provided for versions below 4.16 it can still be manually compiled for lower versions of the engine. Please check our documentation PDF for instructions on how to compile this plugin for versions 4.15 and below.
    Last edited by spidershift; 04-16-2019, 12:32 AM.

  • replied
    Our plan is to compile it into one single file, using a tool like webpack. Makes it easier for us to swap out the files when needed, and maintain the folders as clean as possible. As bandwidth and latency is not a concern locally, there is minimal gain by sharing assets with different other UI's.

    We've yet to test this, so feel free to correct me Spidershift

    Leave a comment:


  • replied
    Yeah, jQueryUI does still seem to work pretty well - I'll give it a try!

    How do you manage imports? Is there some way to run a local server on game start, or do people use webpack or something to get around cross-origin blocking with local files? Sorry, I'm kind of new to this.

    Leave a comment:


  • replied
    Originally posted by DsyD View Post

    Ok thanks! I have been using Bootstrap but it seems a bit heavy and not well-suited to games. I'll check out jQuery UI...

    [Edit] Hmm, now that I look at it, it seems like it hasn't been updated in quite a while. Has that been a problem for you? Are there similar options that are more up-to-date?
    jQueryUI does indeed seem like it hasn't been updated for ages, but usually we use it for it's functionality and use our own CSS and HTML
    Other options to Bootstrap could be Modernizr although I prefer Bootstrap.

    Leave a comment:


  • replied
    Originally posted by spidershift View Post

    You are correct that the range sliders are fidgety as I have experienced this issue with the example project as well. It was happening well before the transparency update and the new dynamic mouse transparency didn't seem to change the way it bugs out. The entire browser widget is just very buggy when it comes to drag-n-drop operations so there hasn't been a way to address this issue directly in the engine.

    However in terms of a workaround there are a few things you can do. The easiest is to just not use range sliders or other weird input elements at all and just use JavaScript for everything. We actually use the jQuery UI for our form elements including range sliders and it removed a lot of hassle. Otherwise another potential workaround if you absolutely need to support native input elements could be to implement some kind of mouse position tracker in JavaScript which would manually remove focus from the slider if the mouse moves too far away. This could be achieved by manually triggering the mouseup event on the input element. But with that being said the jQuery UI is probably your best option with the fewest headaches.
    Ok thanks! I have been using Bootstrap but it seems a bit heavy and not well-suited to games. I'll check out jQuery UI...

    [Edit] Hmm, now that I look at it, it seems like it hasn't been updated in quite a while. Has that been a problem for you? Are there similar options that are more up-to-date?
    Last edited by DsyD; 09-11-2019, 02:51 PM.

    Leave a comment:


  • replied
    There are two ways to load content in the browser, the first being via LoadHTML() and the second through LoadURL(). As mentioned the LoadContent() function is just a wrapper for LoadHTML() by automatically reading a file as a string from your .pak file(s) and the LoadFile() function is essentially a wrapper for LoadURL() by resolving the absolute path of the file and using the file:/// URL. So we probably want to keep the abstraction of the file system being within the project itself, either by manually utilizing the /UI folder at the same level as your /Binaries or /Content folders or making use of the internal project settings to either copy or package files in your /Content folder.

    However you already mentioned a solution which is probably the appropriate implementation within the context of the plugin, and that is to setup your own custom loadSDCard() function within JavaScript. For instance if you load a dummy page using LoadFile() and the "Additional Non-Asset Directories To Copy" as outlined in the documentation you can then setup your own custom file loading function:

    Code:
    ue.interface.loadSDCard = function(url)
    {
        document.location.href = 'file:///' + url;
    };
    And since this page was already loaded using file:/// via the LoadFile() function in blueprints you can call your custom loadSDCard() function with the desired file path once the "ready" event is triggered:




    This is not possible if using LoadHTML() or LoadURL() directly since they utilize the http:// protocol and the browser will prevent you from using file:/// at that point. Note that this "dummy file" workaround is not a good idea for production as the absolute path could be different on various devices. The LoadFile() function is internally using GFilePathBase and this may be required to setup absolute file paths on mobile. So another option could be to use LoadFile() but prepend three ../../../ such that you can start your file path immediately after GFilePathBase. Here is how this would look in the example project:

    Leave a comment:


  • replied
    Originally posted by spidershift View Post

    Thank you for reporting this, I will look into it. The mobile workaround for data coming from the browser to the engine via the ue4() function is achieved through the URL itself and it's possible that something you have setup is breaking this functionality. However when performing mobile tests on Android the LoadFile() function seemed to work just fine and these URL changes were responsive. Are you sure you are not talking about the LoadContent() function? That is not the same as LoadFile() and manually reads the contents from your .pak file(s) and then uses LoadHTML() internally.
    You're right, we are using LoadContent right now for testing and we used LoadHTML prior to that for reading a file on a sdcard. The ideal solution for us would be to allow for opening HTML files outside of the application, we currently store most of our data on a sdcard so we can quickly switch out what we need for each situation. And the LoadFile function did not allow for that, tomorrow I will implement LoadFile and test with that.

    Do you have any plans on implementing a solution for opening files outside the application by path?
    If not I suppose a solution for us would be to use DOM manipulation after the initial LoadFile, and correct accordingly.

    Thank you for quick the response!
    Last edited by Tumenor; 09-11-2019, 10:38 AM.

    Leave a comment:


  • replied
    Originally posted by Tumenor View Post
    Sorted out the last issue, that was my mistake

    What I currently struggle with is the ue4 function on my android phone, I've applied the JS required to make it work however it only works on websites on the internet / local webservers where there is a proper URL, it does not work for me when loading the HTML directly or loading a local file.

    I've tried quite a lot, but it only returns undefined and no communication to UE4 is being picked up, I've applied events to both the interface and the URLchange and none of them trigger.

    It's using Android Webview 52
    Thank you for reporting this, I will look into it. The mobile workaround for data coming from the browser to the engine via the ue4() function is achieved through the URL itself and it's possible that something you have setup is breaking this functionality. However when performing mobile tests on Android the LoadFile() function seemed to work just fine and these URL changes were responsive. Are you sure you are not talking about the LoadContent() function? That is not the same as LoadFile() and manually reads the contents from your .pak file(s) and then uses LoadHTML() internally.

    Leave a comment:


  • replied
    Originally posted by DsyD View Post
    I seem to be having trouble getting range sliders to work properly. When mousing down on the slider "handle" and dragging, it may move for a short distance but then shortly stops responding. It seems like it stops processing if the mouse cursor moves off of the handle. This is on 4.22.3 editor on Windows 10, with the player controller input mode set to Input Mode Game and UI, with mouse transparency enabled on the web widget. Maybe it has to do with the new mouse-transparency functionality or my input mode?
    You are correct that the range sliders are fidgety as I have experienced this issue with the example project as well. It was happening well before the transparency update and the new dynamic mouse transparency didn't seem to change the way it bugs out. The entire browser widget is just very buggy when it comes to drag-n-drop operations so there hasn't been a way to address this issue directly in the engine.

    However in terms of a workaround there are a few things you can do. The easiest is to just not use range sliders or other weird input elements at all and just use JavaScript for everything. We actually use the jQuery UI for our form elements including range sliders and it removed a lot of hassle. Otherwise another potential workaround if you absolutely need to support native input elements could be to implement some kind of mouse position tracker in JavaScript which would manually remove focus from the slider if the mouse moves too far away. This could be achieved by manually triggering the mouseup event on the input element. But with that being said the jQuery UI is probably your best option with the fewest headaches.

    Leave a comment:


  • replied
    Sorted out the last issue, that was my mistake

    What I currently struggle with is the ue4 function on my android phone, I've applied the JS required to make it work however it only works on websites on the internet / local webservers where there is a proper URL, it does not work for me when loading the HTML directly or loading a local file.

    I've tried quite a lot, but it only returns undefined and no communication to UE4 is being picked up, I've applied events to both the interface and the URLchange and none of them trigger.

    It's using Android Webview 52
    Attached Files
    Last edited by Tumenor; 09-11-2019, 07:36 AM.

    Leave a comment:


  • replied
    I seem to be having trouble getting range sliders to work properly. When mousing down on the slider "handle" and dragging, it may move for a short distance but then shortly stops responding. It seems like it stops processing if the mouse cursor moves off of the handle. This is on 4.22.3 editor on Windows 10, with the player controller input mode set to Input Mode Game and UI, with mouse transparency enabled on the web widget. Maybe it has to do with the new mouse-transparency functionality or my input mode?

    Leave a comment:


  • replied
    Wow, they're completely dropping HTML5?

    Anyway, thanks for this super useful plugin. It has made UI development fun again

    Leave a comment:


  • replied
    Hi!

    I am currently struggling with mobile (VR) with a 3D widget. the widget itself is the full 1920x1080 I've set it to, however the browser itself seems to cut as if it believes it is in landscape mode perhaps?

    I am not getting the full height utilized, it's actually stretched. so the content on mobile seems wrong, it's squished in height.

    Any ideas?

    [SOLVED]
    Last edited by Tumenor; 09-11-2019, 06:32 AM.

    Leave a comment:


  • replied
    @spidershift

    Thanks for taking you time and providing us more background-informations.
    As you may noticed, I know almost nothing about unreal engine, and the fact that it run for some big OS, from my point of view, does not automaticaly mean is does not run in a Canvas-Element of a Browser. It maybe logic from a developer-view but not for not or an ignorant one as I am :-)

    I wish you a good day.

    Leave a comment:


  • replied
    Originally posted by FixundFoxi View Post
    Hi spidershift

    Sorry for my stupid question.
    But could you please tell me if WebUI is for Standalone Applications only (for example *.exe-Files on Windows) or does it also work for In-Browser-Applications (using the HTML-Canvas-Element)?

    Kind regards
    Alain
    I usually ignore questions that people are clearly able to find the answers to themselves but since you've asked multiple times here you go:





    However web-based user interfaces is probably the least of your concern right now. I would be worried about the fact that Epic Games just deprecated your entire platform in the 4.23 version of the engine:

    https://docs.unrealengine.com/en-US/...ML5/index.html
    https://github.com/EpicGames/UnrealE...416b71021eab53

    This is because if something doesn't benefit Fortnite or anything making them money they don't actually care at all, which is why Paragon was scrapped and now the entire H5 platform as well. It's only a matter of time before this engine reaches a breaking point. I think the CTO at my previous job put it best, which is that these engine developers are constantly adding new features without ever finishing anything they start and creating an evermore buggy and bloated product. I wouldn't be surprised if we all get to a point where we stop downloading the latest engine updates when things become too unstable. I mean they don't even bother to update their previous branches with bug fixes once they've moved on to the next version and seem to think 2-3 minor updates per engine version is enough to fix the bugs. Yet there are many times you find yourself needing to download the next major version of the engine just to fix an issue only to have new things completely broken in the new version. It's pretty apparent this engine doesn't even come close to the quality of the Source Engine and we didn't even realize what we had until it was gone. There's no question if the Source 2 Engine came out tomorrow our company would jump ship from this engine without ever thinking twice.

    Leave a comment:

Working...
X