問題産生原因
UE4.24到4.26中引擎預設啟用WebGL,這會導緻在使用WebUI插件等其它方法打開網頁時實際幀率達不到60fps,
解決方法
修改/ Engine / Source / Runtime / WebBrowser / Private / CEF目錄裡的CEFBrowserApp.cpp檔案。
找到FCEFBrowserApp::OnBeforeCommandLineProcessing:
void FCEFBrowserApp::OnBeforeCommandLineProcessing(const CefString& ProcessType, CefRefPtr< CefCommandLine > CommandLine)
{
CommandLine->AppendSwitch("enable-gpu");
CommandLine->AppendSwitch("enable-gpu-compositing");
CommandLine->AppendSwitch("enable-begin-frame-scheduling");
}
修改為:
void FCEFBrowserApp::OnBeforeCommandLineProcessing(const CefString& ProcessType, CefRefPtr< CefCommandLine > CommandLine)
{
CommandLine->AppendSwitch("disable-gpu");
CommandLine->AppendSwitch("disable-gpu-compositing");
CommandLine->AppendSwitch("enable-begin-frame-scheduling");
}
編譯成功後即可解決問題。
UE4.26.2版本編譯後的.dll檔案
下載下傳位址:https://gitee.com/ProgrammerLuo/temporary-warehouse/blob/master/WebBrowser/UE4Editor-WebBrowser.dll
參考:https://github.com/tracerinteractive/UnrealEngine/tree/4.26