Search Unity

Removing the GUILayer, GUIText & GUITexture components

Discussion in 'Extensions & OnGUI' started by lina_unity, Jan 7, 2019.

  1. lina_unity

    lina_unity

    Unity Technologies

    Joined:
    May 4, 2017
    Posts:
    1
    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:
    5,445
    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

    Graphics Plumber Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,528
    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:
    5,445
    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:
    5,445
    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:
    3,691
    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.