Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feedback Define GUI Conditionals.

Discussion in 'UGUI & TextMesh Pro' started by MoruganKodi, Aug 15, 2019.

  1. MoruganKodi

    MoruganKodi

    Joined:
    Feb 11, 2015
    Posts:
    77
    Hi.

    The closest thing we have to this is currenty is 'ENABLE_UNITYEVENTS', but I would like to allow my project's/frameworks to automatically exclude any code related to UGUI (UnityEngine.UI namespace) if the UI package is not installed, via conditionals. This implies providing some kind of clear seperation between EventSystems and UGUI.

    This is important, because once UIElements are a run-time thing, there is no point in utilizing multiple different GUI systems (at the same time in a project), and any code related to UGUI specific things should be excludable on projects which utilize UIElements instead of UGUI. This is especially important for frameworks which may need to keep functionality for both or more systems.

    Currently we (or just me?) use ENABLE_UNITYEVENTS to strip UGUI related code, but this this is not enough,
    primarily because UnityEvents can be used independent and standalone to UGUI.
    In many cases, we may still want access to UnityEvents functionality, while excluding code for UGUI, were currently there is no simple means to automatically strip UGUI targeted code if UGUI is excluded.

    Additionaly, such a conditional built-in could also allow us to exclude UGUI even if the UI package is installed.



    EG:
    - UNITY_UI

    or
    - ENABLE_UNITY_UI
    or
    - ENABLE_UGUI

    Additionally, could it be beneficial to include a conditional for run-time UIElements as well (when it finally exists), so we can also strip all run-time-only UIElements related code from a framework or project when that system is not in use?

    EG:
    - ENABLE_UIELEMENTS
    - RUNTIME_UIELEMENTS
    - RUNTIME_XGUI_ENABLED
    - ?ideas?