Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Feature Request Allow batch increment/decrement property values during multi-select, esp. Sprite Order in Layer

Discussion in 'Editor & General Support' started by huulong, Jul 24, 2022.

  1. huulong


    Jul 1, 2013
    I am working on some environment and I often need to reorder my sprites (Sprite Renderer > Additional Settings > Order in Layer). The values are int, not float, so I need to think in advance... If I didn't put a hole between two numbers and suddenly, I need to add a sprite that should appear right between two other sprites with contiguous Order in Layer values, I need to shift a bunch of values up or down to create a hole and insert the new value there.

    So, in my specific case, I need to batch move multiple objects to an upper or lower layer order. I figured I could write a custom tool for that; and in fact, Unity could write such a tool specifically to shift Sprite Renderer layer orders. But I also realized that it could be solved in Unity natively with a more general feature that would be useful for other things as well: batch increase/decrease (increment/decrement for integer) numeric values.

    When selecting multiple objects, if the numerical property is the same, it's easy: you just set it to original value + offset. But when values differ, you just see a hyphen, and setting value will override all properties indiscriminately. If you try to slide (drag over the numeric field's label when the cursor turns to left-right arrow), it just picks one of the values as reference and also overrides all values uniformly after sliding a little.

    So, we'd need to be able to "slide" the values somewhat, even if there are different values among the selected objects' components. One way to represent it could be to show the range of values as "[min - max]". So, when you slide the values up or down, at least you get some feedback as you see the min and max change (and even, why not, a tooltip that shows the offset/delta you are applying.

    1. Select objects A and B with same component but property values differ: -2 and 9 (integer).
    2. Select A and B. Instead of hyphen on property value, you see [-2 - 9] (or [-2 ; 9], etc.)
    3. Drag over field's label and slide left or right to decrease or increase values. For instance, increase them by 3: new range is [1 - 12]

    This would allow us to shift sprite order in layer easily, but also all sorts of numerical values.
    When dealing with clamped values (Min, Max and Range attributes) we need to decide how it works (probably, if you hit a wall then move back, do not shrink the range, preserve it as long as no value hits the limit).