Planned maintenance has been done but it did not solve the problem. So work will continue on this and a new time for trying updates will be announced asap.

WebEngineView: Problem with loading a WebGL project (exported from Unity)



  • Hello! I'm trying to download a WebGL project (exported from Unity 2018.3.14f1) in Web Engine View.

    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();
    }
    

    The 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 Build Setting

    When you open a WebGL project in Chrome, everything loads very quickly (instantly).
    Screenshot Open Chrome

    When you open WebGL in Web Engine View, the project takes a very long time to load (about 5-6 minutes).
    Screenshot Loading WebGL in WebEngineView
    Screenshot Loaded WebGL 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 ? Help please...

    Below attached the project WebGL and Qt project
    WebGL Project
    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).


Log in to reply