Example #1
0
    static public void Draw(SerializedObject serializedObject, LightingSettings.SortingLayer sortingLayer, string serializationDepth = "")
    {
        bool value = GUIFoldout.Draw("Sorting Layer", sortingLayer);

        if (value == false)
        {
            return;
        }

        SerializedProperty order = serializedObject.FindProperty(serializationDepth + "sortingLayer.Order");
        SerializedProperty name  = serializedObject.FindProperty(serializationDepth + "sortingLayer.name");

        EditorGUI.indentLevel++;

        string[] sortingLayerNames = GetSortingLayerNames();
        int      id    = Array.IndexOf(sortingLayerNames, sortingLayer.Name);
        int      newId = EditorGUILayout.Popup("Name", id, sortingLayerNames);

        if (newId > -1 && newId < sortingLayerNames.Length)
        {
            string newName = sortingLayerNames[newId];

            if (newName != sortingLayer.Name)
            {
                name.stringValue = newName;
            }
        }

        EditorGUILayout.PropertyField(order, new GUIContent("Order"));

        EditorGUI.indentLevel--;
    }
Example #2
0
    static public void Draw(LightingSettings.SortingLayer sortingLayer)
    {
        bool value = GUIFoldout.Draw("Sorting Layer", sortingLayer);

        if (value == false)
        {
            return;
        }

        EditorGUI.indentLevel++;

        string[] sortingLayerNames = GetSortingLayerNames();
        int      id    = Array.IndexOf(sortingLayerNames, sortingLayer.Name);
        int      newId = EditorGUILayout.Popup("Name", id, sortingLayerNames);

        if (newId > -1 && newId < sortingLayerNames.Length)
        {
            string newName = sortingLayerNames[newId];

            if (newName != sortingLayer.Name)
            {
                sortingLayer.Name = newName;
            }
        }

        sortingLayer.Order = EditorGUILayout.IntField("Order", sortingLayer.Order);

        EditorGUI.indentLevel--;
    }
Example #3
0
    static void SortingLayer(LightingSettings.SortingLayer sortingLayer)
    {
        EditorGUI.BeginDisabledGroup(Lighting2D.ProjectSettings.renderingMode != RenderingMode.OnRender);

        GUISortingLayer.Draw(sortingLayer);

        EditorGUI.EndDisabledGroup();
    }