Unity HWND resize

Hello, this is the first time I’m posting here.
I’m trying to embed a Unity game into Electron.js.
I used this code: GitHub - MrAndrewMal/electron-unity: Embed unity app in electron window
The code works perfectly until I paste my own Unity project into it. The issue is that when I resize the window, the embedded Unity content doesn’t move along with it (only with my Unity project).
I believe the problem lies within the build settings.

Here is the settings I use:

Electron means the app is running in the browser? That means your build platform is WebGL, correct?

Since your player settings seem to show the settings of a desktop build. Pretty sure there is no “windowed” option for WebGL builds. Check if you are actually looking at the WebGL player settings, there’s a row of tabs near the top of the player settings with symbols for each platform.

No, Electron is a framework for building cross-platform desktop applications using web technologies like HTML, CSS, and JavaScript. It enables applications to run outside the browser as standalone desktop apps. The build platform is not WebGL.

:eyes: I am confused. What is the purpose of that? You create a desktop application, say for Windows, then you wrap it in browser technology. But that means it would still only run on Windows, right? Unless they bring along a Windows VM this wouldn’t work on any non-Windows platform.

From their description I got that it allows the exact opposite: you have web technology, say a website or web application, and Electron wraps that so you can run it as a standalone desktop executable. That’s why I was assuming you build for WebGL and wrap it so it can also run as a desktop application.

I want to make a game editor where the community can create maps, scripts, and more. Instead of using Unity or a WPF app, I prefer Electron.js because it’s easier to add features like a file explorer and photo editor. My idea is to embed Unity using hwnd, and even though it’s Windows-only, I don’t think that’s a big issue. Any other suggestions for a game editor?

From the code in Form1.cs of the ExampleWindow.zip from the docs, it would seem this requires translating a resize into a MoveWindow call.

        private void panel1_Resize(object sender, EventArgs e)
        {
            MoveWindow(unityHWND, 0, 0, panel1.Width, panel1.Height, true);
            ActivateUnityWindow();
        }

        private void ActivateUnityWindow()
        {
            SendMessage(unityHWND, WM_ACTIVATE, WA_ACTIVE, IntPtr.Zero);
        }

I’ve previously used the embedding path to embed a Unity player in a week-long hacking project, but don’t remember having resizing issues. But then, maybe I just didn’t test well enough.