As a continued effort to support the latest Ubuntu versions 22.04 and forward, Unity is experimenting with the support for the wayland desktop environment for the linux player builds on Unity 2023.1.x.
Wayland is a new windowing protocol aiming to replace legacy X11 with flexibility, security and performance improvements. It is being under active development and released its stable version last year. It will be the default protocol on Ubuntu 22.04. However, due to the current instability in the graphics drivers, the support is only limited to AMD and Intel GPUs which use the mesa driver with wayland.
A command line argument “-force-wayland” needs to be passed when launching the player. The player is currently default to xwayland.
unfortunately we currently are still evaluating the wayland support in the editor. The idea is we will catch up if ubuntu decides to ship it by default in their new LTS, which i believe is 24.04 ATM.
I would like to add a +1 this for Unity editor support. Wayland is fully adopted by KDE and Gnome, my personal experience with KDE is perfect feature parity as far as I can tell. Wayland is now default on Fedora and Ubuntu, and Nvidia drivers have improved its support. Thanks for considering.
@tylerinthezoo Hello, I found quite the severe problem with Wayland. Please take a look at IN-82277 - Linux | Wayland | Elapsed Time is not accurate anymore when in background for a while.
This looks like a very widespread Wayland problem. I’m trying to find out who to blame right now Wayland says it’s the compositors fault, compositor says it’s the games fault.
For anyone who wants to test this too: TimerTest.zip (1.3 MB)
Requirement: A Wayland desktop environment (Gnome, KDE, Hyprland)
Make a Linux build.
optional: Start with “-force-wayland” so experimental wayland is used (I say optional because it happens in XWayland too)
let game run for some seconds, the elapsed time is displayed.
at around 10 seconds put the game in the background
have a clock running or count yourself for 30 seconds
put game in foreground, elapsed time is ~20 seconds but it should show ~40 seconds.
I have implemented a correctly working Wayland window in C# if Unity devs want more reference.
For Unity though it makes sense to use GL buffers, or VK_KHR_wayland_surface for Vulkan buffers.
Of course IN-82277 was closed as “can’t reproduce”. This really grinds my gears because I tested on 3 different systems before reporting. 2 Laptops, 1 Desktop, Arch, Fedora, Ubuntu, 1 Nvidia, 2 AMD, all Wayland in common.
@tylerinthezoo Sorry for pinging again, but someone has to take a look at it again.
Hey @zezba9000, you seem knowledgeable enough. I’m getting the no one is really responsible treatment and I do wonder how this can even be solved.
Wayland stops rendering and sending frame callbacks to apps which basically means for pretty much every game that the game loop stops or hangs in waiting for a frame. Some workaround send at 1hz or something. I talked with KDE devs and while they say that they could write a workaround or make an option to force rendering, I just see a very fundamental problem in Wayland.
What do you think about it? Can it be solved that game loops run in the background without the user setting anything esoteric?
Hey Enzi, our team typically relies on QA to reproduce the issue to save time and follow the correct bug filing. I could investigate this when I have free time. My personal setup right now has some issues with wayland on nvidia. So my capability here may be very limited.
I believe (probably @tylerinthezoo can confirm this) that the Unity player uses LibSDL to create its window. Maybe you should reach to the SDL devs, they should know.