Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feedback Expose EditorGUI.SortingLayerField and official API to retrieve sorting layer names

Discussion in 'Immediate Mode GUI (IMGUI)' started by Xarbrough, Jun 20, 2019.

  1. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    Please expose the internal API to draw the builtin SortingLayerField and add a way for users to retrieve the sorting layer names in the project in editor scripting.

    Currently there is no way other than using reflection or hard-coded strings to create a list of sorting layer names ourselves and drawing them in a popup is always a hassle, although this is a common thing to do for editor tools. Our current project has multiple tools which create or set sprite and mesh renderer properties including the sorting layer and order. For now we are using the internal API via reflection, which is convenient and works well, but of course is very brittle and slow performance-wise.