Experimental Wayland Support for Linux Player

Hello Unity Developers on Linux,

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.

Please stay tuned for more updates.

16 Likes

Now that is great new. Thanks Unity devs.

Do you have any plans to support Wayland in an editor?

This is in also our roadmap, but will not start until we feel things are more stable with wayland.

1 Like

Is it okay now?

Is it okay now?

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.

Is it okay now?
https://discourse.ubuntu.com/t/jammy-jellyfish-release-notes/24668

I’ve tested Wayland support and it works well !

How can I set my game to use Wayland by default ?

Also the icons seem broken and playing my game under Wayland shows the default executable icon instead of the game icon.

would you mind to file a bug for us on that? I think it might be related to the icon is being set using some x11 calls.

Any news? Fedora has wayland by default now. Unity is pretty much the only thing left that prevents me from using wayland.

Will Wayland Player support not be in Unity 2022.3 ?

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.

3 Likes

@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 :smiley: 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.

1 Like

Of course IN-82277 was closed as “can’t reproduce”. :melting_face: 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?

@Enzi did you reproduce it on both Gnome and KDE?

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.

Gnome, KDE and Hyprland. And it’s not just Nvidia related which has historically the most problems with Wayland. AMD Wayland is affected too.

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.