Hello Everyone
Before I start ranting, I would love to give this DISCLAIMER:
I love Unity and I love the hardworking team behind it, I do agree that Unity needed a major overhaul for their UI system, and the general approach seemed good to me.
Also I do understand the difference between Unity’s use case for the UI compared to other UI frameworks and the fact that Unity had to reinvent the wheel for so many components due to the fact that this is a game engine, not some UI framework running natively on one OS.
I don’t want this to sound like some whiny entitled post
Background
I have been using Unity for years now, I started working on unity Since Unity 4.0, and I have witnessed the ERA moving from IMGUI to uGUI, and it was a great and major update at the time.
Also it might be very important to know that I’m working in a team making a game that works with VERY HEAVY UI workflow, as a matter of fact, 90% of our game is just UI, so our case might be different from doing a simple HUD for a shooter game.
However, Unity UI system was always fine for these use cases, doing a simple HUD was a trivial task and required no overhaul for the system, the problems start to arise when a real use case for a UI intensive app is rapidly scaling.
We have been facing some very big issues for maintaining our UI in a huge project, we have been working before nested prefabs, and making components based architecture wasn’t trivial at all, but somehow we managed, but the app kept growing larger and larger, and soon we started to have some performance issues just to animate few elements and to use a recycler view for a very active chat thread and so on.
The app was getting really sluggish for an app with only menus and buttons and lists, compared to writing some UI mobile apps using native languages or even frameworks like flutter or react, it was extremely painful.
Of course I can’t blame all the performance issues on Unity, we had our fair share of mistakes and rushed code, but I have to say making UI performant in Unity is way more tedious task compared to those frameworks
When the new UI system got announced, a glimpse of hope sparked in our souls.
Rant Start
We kept waiting for months - or few years now - for the new UI to mature enough so it can be used in production and enough online resource can be found to solve problems, can’t say we are there yet, even when we were contacted by Unity’s success team they didn’t advise us to use it in production yet - this was around a year ago -
Today I decided to evaluate the system and see if we can adopt it soon, because the app really needs some heavy optimization, and we are considering alternatives to Unity if the new UI system wasn’t good for our needs.
So I started following this tutorial:
It seemed VERY long to me to make a very simple list, but I said I will keep my judgment till I’m done, maybe it’s just too detailed of a tutorial, Alas, my first hunch was actually correct.
Building a UI using the UI builder seemed good and intuitive enough, although it had some real problems like all the buttons show the same tooltip for example, and I don’t know what I’m clicking exactly if it weren’t for the tutorial. but At least generating a screen with one file asset that can be parsed somewhere seemed very good to me.
TLDR: you can start reading from here!
The real problems started when I reached the coding part, and this is where the core of this long post is, every decision made in this area by Unity seemed dead wrong to me!
Starting with how you get elements from the visual tree, I mean:
// Store a reference to the character list element
m_CharacterList = root.Q<ListView>("CharacterList");
Seriously? get element by a string ? This was hard to use when we used to code on Android gingerbread almost 10 years ago although the IDE offered some help back then to match the IDs
The fact that you can’t attach scripts to your UI elements (MonoBehaviour or not, I know they are not game objects), the fact that we can’t make a “prefab” that has access to some scriptable object, but rather the tutorial suggest we load the data this way:
m_AllCharacters.AddRange(Resources.LoadAll<CharacterData>("Characters"));
I mean this can simply kill our entire architecture, we should have some gigantic script as MonoBehaviour and then pass everything to the children though custom code, and then pass the data in a none typed object
newListEntry.userData = newListEntryLogic;
We also had to pass the item that will be dynamically created from the parent MonoBehaviour and then we kept reference to it so we can instantiated it, with assigning its height from code!
Assigning listeners and callbacks from code as well because the inspector can’t help you here since nothing is a game object
I can go on and on about this but this is just few mind blowing decisions I have seen while trying to explore the new system, and if I wanted to compile a list of what I think should be burned to the ground, this post would have been much longer
REALLY TLDR:
It seemed to me Unity is adopting the old web standard because everyone is familiar with it at the time that everyone is ditching it and evolving to something new, you can see what some frameworks are doing with WebAssembly instead of JS and jQuery stuff, but Unity decided that jQuery is a good part of the web and we should do uQuery ?
This seems to be the same way when Unity decided to support JavaScript to make scripts to draw the attention of the Armada of armature developers who are familiar with JavaScript, but years later they had to ditch it since it couldn’t keep up
Final words:
I really don’t think this is usable in any way for us, and I think coding a UI that is remotely serious and not a school project is a really painful task.
Is this really how it’s planned in the future ? is this how we are supposed to code our UI? or the system is still very early to use and some major scripting tools are coming?