I'm trying to download a WebGL project (exported from Unity 2018.3.14f1) in Qt WebEngineView (Qt 5.12.0)
For an example, WebGL project was created in Unity 2018 - an empty scene without objects (camera only) - Screenshot: Unity project
and exported to the WebGL Assembly (applied .gzip compression, build size 2.3 MB) - Screenshot: Unity build settings
The Qt project was take from Qt's library of examples ("WebEngine Widgets Minimal Example").
#include <QApplication>
#include <QWebEngineView>
QUrl commandLineUrlArgument()
{
const QStringList args = QCoreApplication::arguments();
for (const QString &arg : args.mid(1)) {
if (!arg.startsWith(QLatin1Char('-')))
return QUrl::fromUserInput(arg);
}
return QUrl(QStringLiteral("file:///F:/qt/test4Exp/index.html"));
}
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
QWebEngineView view;
view.setUrl(commandLineUrlArgument());
view.resize(1024, 750);
view.show();
return app.exec();
}
When you open a WebGL project in Chrome, everything loads very quickly (instantly) - Screenshot: WebGL project opened in Chrome
When you open WebGL in WebEngineView, the project takes a very long time to load (about 5-6 minutes) - Screenshot: WebGL project loading in WebEngineView
... but then it opens - Screenshot: WebGL project loaded in WebEngineView
The WebGL project is opened from a local drive. I have tried various options for Unity export parameters (brodil compression, code optimization, etc.). Tell me, what could be the problem? Can be applied to any option in the Assembly or in QCoreApplication::setAttribute ?
Below attached the project WebGL and Qt project
The problem was solved after running the application from under exe file (not from under QtCreator).Everything works faster under exe file. Apparently the launch and initialization of the Unity engine is slowed down by QtCreator. When the application is running under exe web project launch in Web Engine View takes 2-3 seconds (on an old PC 7-9 seconds).