The Optimized Web Browser Plugin provides an enhanced version of the standard WebBrowserWidget for Unreal Engine. It focuses on improving performance without removing any functionality, making it ideal for projects that require web content integration with better performance characteristics.
A key feature of this plugin is the ability to control the browser frame rate (up to 120fps), enabling developers to create smoother web experiences while maintaining control over performance. The plugin also provides hardware acceleration management and background tab throttling for optimal resource usage.
To install the Optimized Web Browser Plugin in your Unreal Engine project:
OptimizedWebBrowser
folder to your project's Plugins
directoryPlugins
directory, create one in your project's root folderThe plugin is now installed and ready to use in your project.
Optimized rendering and reduced CPU usage compared to the standard web browser widget.
Set the browser frame rate to balance between smoothness and performance. The plugin now supports up to 120fps for high refresh rate displays.
// In C++
Browser->SetBrowserFrameRate(60);
// In Blueprints
// Use the "Set Browser Frame Rate" node
Enable or disable hardware acceleration to optimize performance based on your target hardware.
// In C++
Browser->SetHardwareAccelerationEnabled(true);
// In Blueprints
// Use the "Set Hardware Acceleration Enabled" node
Reduce CPU usage when the browser is not visible to improve overall application performance.
// In C++
Browser->SetBackgroundTabThrottlingEnabled(true);
// In Blueprints
// Use the "Set Background Tab Throttling Enabled" node
Send messages from Unreal Engine to the browser's JavaScript console for debugging or communication.
// In C++
Browser->LogToConsole("Hello from Unreal Engine!");
// In Blueprints
// Use the "Log To Console" node
To use the Optimized Web Browser in your Unreal Engine project with Blueprints:
To use the Optimized Web Browser in your C++ code:
#include "OptimizedWebBrowser.h"
// Create an optimized web browser
UOptimizedWebBrowser* Browser = CreateWidget<UOptimizedWebBrowser>(GetWorld(), UOptimizedWebBrowser::StaticClass());
// Configure performance settings
Browser->SetBrowserFrameRate(60); // Can now set up to 120 fps
Browser->SetHardwareAccelerationEnabled(true);
Browser->SetBackgroundColor(FColor(255, 255, 255, 255));
Browser->SetBackgroundTabThrottlingEnabled(true);
// Load a URL
Browser->LoadURL("https://www.example.com");
// Log a message to the browser's JavaScript console
Browser->LogToConsole("Hello from Unreal Engine!");
The Optimized Web Browser Plugin provides a variety of functions to control browser behavior and performance. All functions are accessible through the Blueprint system and C++ code.
Load the specified URL.
Parameters: FString NewURL
- The URL to load
// Example usage in Blueprint
Browser->LoadURL("https://www.example.com");
Load a string as data to create a web page.
Parameters:
FString Contents
- The HTML contentFString DummyURL
- Dummy URL for the page// Example usage in Blueprint
Browser->LoadString("Hello World
", "about:blank");
Executes a JavaScript string in the context of the web page.
Parameters: const FString& ScriptText
- JavaScript code to execute
// Example usage in Blueprint
Browser->ExecuteJavascript("document.body.style.backgroundColor = 'red';");
Get the current title of the web page.
Returns: FText
- The page title
// Example usage in Blueprint
FText Title = Browser->GetTitleText();
Gets the currently loaded URL.
Returns: FString
- The current URL
// Example usage in Blueprint
FString CurrentURL = Browser->GetUrl();
Logs a message to the browser's JavaScript console.
Parameters: const FString& Message
- The message to log
// Example usage in Blueprint
Browser->LogToConsole("Hello from Unreal Engine!");
Set the browser frame rate (15-120 fps).
Parameters: int32 FrameRate
- The frame rate to set
// Example usage in Blueprint
Browser->SetBrowserFrameRate(60);
Enable or disable hardware acceleration.
Parameters: bool bEnabled
- Whether to enable hardware acceleration
// Example usage in Blueprint
Browser->SetHardwareAccelerationEnabled(true);
Set the background color of the browser.
Parameters: FColor Color
- The background color
// Example usage in Blueprint
Browser->SetBackgroundColor(FColor(255, 255, 255, 255));
Enable or disable throttling of background tabs.
Parameters: bool bEnabled
- Whether to enable background tab throttling
// Example usage in Blueprint
Browser->SetBackgroundTabThrottlingEnabled(true);
Called when the URL changes.
Parameters: const FText& Text
- The new URL
// Example usage in Blueprint
Browser->OnUrlChanged.AddDynamic(this, &YourClass::HandleUrlChanged);
Called when a popup is about to spawn.
Parameters:
FString URL
- The popup URLFString Frame
- The frame information// Example usage in Blueprint
Browser->OnBeforePopup.AddDynamic(this, &YourClass::HandleBeforePopup);
Called when the browser has console messages to print.
Parameters:
const FString& Message
- The console messageconst FString& Source
- The source of the messageint32 Line
- The line number// Example usage in Blueprint
Browser->OnConsoleMessage.AddDynamic(this, &YourClass::HandleConsoleMessage);
To get the best performance from the Optimized Web Browser Plugin, consider the following tips:
The Optimized Web Browser Plugin applies several techniques to improve performance:
The Optimized Web Browser Plugin is compatible with all platforms supported by the standard WebBrowserWidget:
Some features may have platform-specific limitations. For best results, test your application on all target platforms.
If you encounter any issues or have questions about the Optimized Web Browser Plugin, please contact the author: