Removing the GUILayer, GUIText & GUITexture components

As Unity moves ahead, we discover small bits that get naturally left behind. This time we are looking at the GUILayer, GUIText and GUITexture components that, as some of you may have already noticed, have been marked as deprecated since a while back.

First, let’s take a look at what these components do.

  • The GUI Layer is a component you would attach to the Camera to be able to render GUI Text and GUI Texture components.
  • GUI Text and GUI Texture allow text and UI-related 2D images to be displayed in screen coordinates.

Now, why are we removing these?

These components predate even the OnGUI system, i.e. they come from a time when Unity was at version 1.x. Completely new ways to handle user interfaces in Unity have come along since then and it is time to really say goodbye to the leftovers of a legacy-legacy UI system. This change is expected to appear in either 2019.2 or 2019.3 so everyone should have enough time to review projects that still rely on GUILayer, GUIText or GUITexture.

We’d like to hear if you are still using these components – will their removal affect your workflows and creative processes?

2 Likes

What I want to know is if I can safely remove the GUILayer from everywhere without getting a performance hit, since Unity searches for the component anyway, even though it’s deprecated.

Context: Performance tips for Unity 2d mobile | Damian Connolly | divillysausages.com

Right, well as long as the components exist in Unity, MouseEvents has to do the component search (even if it’s deprecated – so that existing projects continue to work), and it’s unfortunate that this causes an allocation. However once we actually remove it, then it will obviously stop searching for it!

2 Likes

Then please, please remove it.

My sample size is small and my evidence anecdotal, but the only “use” I’ve heard anyone have for the GUILayer, is to add it to workaround that issue.

(edit: And personally, you can go ahead and delete OnGUI as well)

Hey @Aras and @ascentress ,

I hope you are interpreting the lack of participation in this thread as what I think it is, which is that no one really cares about GUILayer, GUIText or GUITexture (and I would go as far as to include OnGui as well) and that in fact, their inclusion in Unity only causes problems and nothing else.

Please remove them.

1 Like

You should probably post these in a forum that’s actually read - like Scripting or Editor.

I would love it if you purged these, as they’re just in the way.

Please remove

Never used these components sind 2013. :wink:

So why is GUI Layer still in Unity? No one uses it, it makes everything worse, it’s just bad.

I do not understand how you can deprecate and remove other stuff that people actually use, without much warning, but you hold on to GUI Layer for dear life, much to the dismay of your users.

I understand the amount of time it takes to deprecate a feature is frustrating, but I do have some good news in regards to this - - legacy GUI components are no longer in Unity starting with 2019.3. Means that there’s no more of that stuff starting with this year’s LTS release.

Good news! Thank you for the update.

Hi, i am very concerned about this because, i am not a software guy, i am just a scientist using Unity since the beginning of Unity to make educational apps that I and others use for teaching, my apps are build on GUI Layer and GUI Text and other legacy stuff, I have been using my apps for years now regularly updating them and now with this removal I will not be able to update them.
What are you proposing to fix this? I use to write my scripts in unity javascript, this is also gone, What shall I do?

From my point of view as a user: If you want to use the newest Unity engine features, upgrade your code to C# and replace GUIText components with either IMGUI, Unity UI (4.6 version) or the upcoming UIElements system (2020 or later). Unity has been supporting legacy feature for years now, but at some point users just have to upgrade to the newer versions or continue to use the old editor version. If you do not want to upgrade, you can continue to use Unity 2019.1 for multiple years until some incompatibility with newer operating systems would force you to upgrade. Even more, you can always delay upgrading your operating system as long as possible, that would give you a couple of years on top of that.

Thank you for your answer, the problem is that since I upgraded my mac with the last mac os and xcode, i am not able to get a working build with the unity version 2017 or the early 2018, either unity freeze when trying to build the resources folder in mono or fail when using il2cpp :frowning: and for an other app of mine the build succeed but xcode fails to build refering to il2cpp issues (see my post in ios dev part of the forum). :frowning:

My game relies on some key asset DLL’s that are no longer supported. Some of these DLL’s have references to GuiTexture and fail my build since I upgraded to 2019.3…

What do I do now?

If you’re in control over development you have a couple of options:

  • Contact the original authors of the DLLs and ask them if they consider upgrading them to a newer version without GuiTexture.
  • Try to obtain the source code for the DLLs
  • Use a tool like ILSpy to decompile the library and try to remove the legacy code this way and rebuild
  • Ditch the tool entirely and replace it with your own

If you’re doing this for somebody else:

  • Tell them it’s too late to upgrade the project with reasonable costs. GUIText was deprecated years ago, its been more than enough time to upgrade to IMGUI, Unity UI, NGUI, 2DTK or any toolset that has replaced the old GUI components since.

In both cases, you can also opt for not upgrading to Unity 2019.3. That’s pretty bleeding-edge. How come you need cutting-edge features as well as deprecated ones? Maybe it’s easier to stay on an older version.

3 Likes

This change crashes my game (Unity’s cpp GameObject::WillDestroyGameObject) when changing between scenes that contain Cameras made in Unity 2019.2 (aka mods). Crash dmp and more info in: Modding with Addressables?

@ascentress

Hello,
I am trying to open a 5.5.3f1 project into 2019.3.2f1 for multiple reasons.

Everything went quite smoothly as I upgraded some scripts to match the current API.

The only remaining issues I have are related to this very topic, here are the last errors I get :


(end of the two cut lines)
5505835--564751--Error2.png

All these errors come from the same script : “SteamVR_Camera.cs”. Here are screenshots of this script namespaces and of the problematic areas :

5505835--564742--namespaces.png
5505835--564736--group1.png
5505835--564739--group2.png

Do you know what I have to use instead of GUILayer for my project to compile ?
Thanks in advance.

@PierreLouis29 Hey! Sorry I’m replying quite late. Looking at the code of the SteamVR plugin, I think, these code blocks should be safe to remove. I found this paragraph in the documentation for SteamVR (found here: openvr/samples/unity_keyboard_sample/Assets/SteamVR/readme.txt at master · ValveSoftware/openvr · GitHub):

My assumption is that this code is intended to shift the GUILayer component to another object to avoid compatibility issues. Since GUILayer was only needed to render GUITexture/GUIText, there is no reason for this code to exist anymore and you can safely remove it from the plugin inside your project.

You might also want to look into updating your version of the SteamVR plugin from the Asset Store since GUILayer behaviour has been fixed there. I cannot assure that your project will be fully compatible with it, however.

Hello everyone , this is a small script that you can use to clean up your projects. It just goes through every scene, dirties it and re-saves it.

1 Like