Multiple group attributes / Groups within Groups. Old title: BoxGroup in BoxGroup

Issue #101 resolved
Alwin Lam created an issue

I can't seem to create a BoxGroup in another BoxGroup as it says "Duplicate BoxGroup attribute". Is it possible to achieve this?

Comments (6)

  1. Bjarke Elias

    Hi Alwin,

    Currently it is only possible to assign one group attribute per property unfortunately.

    But it is still is still possible to the same result with a little more effort:

    -ooUR6DMb4NyW89IGBfixTDByIXcA8h8u-xk6OmyIPO6Ulu02G0cUORDzwgqZTmS6yhX_zxqM-C3d1o2Z5MBXN0Iq-_ZMIwlJNqsu6s4bO0F1kR3dMUjedqC16uBUu85.png

    public class MyComponent : MonoBehaviour
    {
        [PropertyOrder(0)]
        public int A;
    
        [PropertyOrder(2)]
        public int B;
    
        [BoxGroup("My Group", order: 3)]
        public int C;
    
        [BoxGroup("My Group", order: 3)]
        public int D;
    
        [PropertyOrder(4)]
        public int E;
    
        [PropertyOrder(6)]
        public int F;
    
    
    #if UNITY_EDITOR
        [OnInspectorGUI, PropertyOrder(1)]
        private void BeginWrapGroup()
        {
            Sirenix.Utilities.Editor.SirenixEditorGUI.BeginBox("Wrapped Group");
        }
    
        [OnInspectorGUI, PropertyOrder(5)]
        private void EndWrapGroup()
        {
            Sirenix.Utilities.Editor.SirenixEditorGUI.EndBox();
        }
    
    #endif
    }
    
  2. Tor Esa Vestergaard

    This feature has been added in the next patch, and is done using group paths:

    public class MyComponent : MonoBehaviour
    {
        public int A;
    
        [BoxGroup("WrappedGroup")]
        public int B;
    
        [BoxGroup("WrappedGroup/MyGroup")]
        public int C;
    
        [BoxGroup("WrappedGroup/MyGroup")]
        public int D;
    
        [BoxGroup("WrappedGroup")]
        public int E;
    
        public int F;
    }
    
  3. Log in to comment