Search Unity

Removing the GUILayer, GUIText & GUITexture components

Discussion in 'Immediate Mode GUI (IMGUI)' started by ascentress, Jan 7, 2019.

  1. ascentress

    ascentress

    Unity Technologies

    Joined:
    May 4, 2017
    Posts:
    3
    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. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,298
    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: https://divillysausages.com/2016/01/21/performance-tips-for-unity-2d-mobile/

     
    Last edited: Jan 7, 2019
  3. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,544
    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!
     
    Circool and AcidArrow like this.
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,298
    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)
     
    Last edited: Jan 7, 2019
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,298
    Hey @Aras and @lina_unity ,

    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.
     
    Last edited: Jan 28, 2019
    BinaryCats likes this.
  6. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,472
    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.
     
  7. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    94
    Please remove
     
  8. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    636
    Never used these components sind 2013. ;)
     
  9. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,298
    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.
     
  10. ascentress

    ascentress

    Unity Technologies

    Joined:
    May 4, 2017
    Posts:
    3
    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.
     
  11. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,298
    Good news! Thank you for the update.
     
  12. Icelander78

    Icelander78

    Joined:
    Sep 19, 2012
    Posts:
    34
    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?
     
  13. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    636
    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.
     
  14. Icelander78

    Icelander78

    Joined:
    Sep 19, 2012
    Posts:
    34
    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 :( 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). :(
     
  15. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,433
    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?
     
  16. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    636
    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.
     
    Meltdown likes this.
  17. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    131
    Last edited: Feb 13, 2020 at 12:03 AM
unityunity