Sorting layers are a way to group sprites and objects to control their rendering order on the screen. Objects in higher sorting layers appear in front of those in lower layers.
Click to reveal answer
beginner
How does the 'Order in Layer' property affect rendering?
The 'Order in Layer' sets the drawing order of objects within the same sorting layer. Higher values are drawn on top of lower values.
Click to reveal answer
intermediate
Can two objects in different sorting layers have the same 'Order in Layer' value? What happens?
Yes, they can. The object in the sorting layer with higher priority will be drawn on top, regardless of the 'Order in Layer' value.
Click to reveal answer
beginner
How do you create a new sorting layer in Unity?
Go to the 'Tags and Layers' settings in Unity, then add a new sorting layer by clicking the '+' button under the Sorting Layers section.
Click to reveal answer
intermediate
Why is sorting layers preferred over changing the Z position for 2D sprite rendering?
Sorting layers provide a clear and easy way to control rendering order without affecting physics or camera settings, unlike changing the Z position which can cause unintended side effects.
Click to reveal answer
What determines which sprite appears on top in Unity's 2D rendering?
ATexture resolution
BSprite size
CSprite color
DSorting layer and order in layer
✗ Incorrect
Unity uses sorting layers and order in layer to decide which sprite is drawn on top.
If two sprites are in the same sorting layer, which one appears on top?
AThe one with lower 'Order in Layer' value
BThe one with higher 'Order in Layer' value
CThe one with bigger sprite size
DThe one with higher Z position
✗ Incorrect
Within the same sorting layer, the sprite with the higher 'Order in Layer' value is drawn on top.
Where do you add new sorting layers in Unity?
ATags and Layers settings
BPhysics settings
CLighting settings
DAudio settings
✗ Incorrect
Sorting layers are managed in the Tags and Layers settings in Unity.
What happens if two sprites are in different sorting layers but have the same 'Order in Layer'?
AThe sprite in the higher sorting layer is drawn on top
BThey overlap randomly
CThe sprite with bigger size is drawn on top
DThe sprite with lower sorting layer is drawn on top
✗ Incorrect
Sorting layers have priority over 'Order in Layer' values when layers differ.
Why might you avoid using Z position to control sprite order in 2D games?
AIt reduces game performance
BIt changes sprite colors
CIt can interfere with physics and camera settings
DIt disables animations
✗ Incorrect
Changing Z position can affect physics calculations and camera behavior, so sorting layers are preferred.
Explain how sorting layers and order in layer work together to control sprite rendering order in Unity.
Think of sorting layers as folders and order in layer as the position inside the folder.
You got /4 concepts.
Describe the steps to add a new sorting layer and assign it to a sprite in Unity.
Remember sorting layers are managed in project settings, then assigned per sprite.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of Sorting Layers in Unity?
easy
A. To apply physics properties to objects
B. To change the physical position of objects in the scene
C. To set the color of objects
D. To group objects and control their visual stacking order
Solution
Step 1: Understand Sorting Layers concept
Sorting Layers are used to group objects so Unity knows which objects appear in front or behind others visually.
Step 2: Differentiate from other properties
Sorting Layers do not move objects physically or change physics or color; they only affect visual stacking order.
Final Answer:
To group objects and control their visual stacking order -> Option D
Quick Check:
Sorting Layers = Visual stacking order [OK]
Hint: Sorting Layers control visual order, not position or physics [OK]
Common Mistakes:
Confusing sorting layers with object position
Thinking sorting layers affect physics
Assuming sorting layers change object color
2. Which of the following is the correct way to set the sorting order of a SpriteRenderer component in Unity C# script?
easy
A. spriteRenderer.orderSorting = 5;
B. spriteRenderer.sortOrder = 5;
C. spriteRenderer.sortingOrder = 5;
D. spriteRenderer.layerOrder = 5;
Solution
Step 1: Recall SpriteRenderer property names
The correct property to set the order within a sorting layer is sortingOrder.
Step 2: Check each option for syntax correctness
Only spriteRenderer.sortingOrder is a valid property; others are incorrect or do not exist.
Final Answer:
spriteRenderer.sortingOrder = 5; -> Option C
Quick Check:
Correct property name = sortingOrder [OK]
Hint: Use 'sortingOrder' property to set order in script [OK]
Common Mistakes:
Using incorrect property names like sortOrder
Confusing sorting layer with sorting order
Trying to set sorting layer with sortingOrder
3. Given two sprites in the same sorting layer with these orders: spriteA.sortingOrder = 3; spriteB.sortingOrder = 7; Which sprite will appear on top visually?
medium
A. spriteB will appear on top
B. spriteA will appear on top
C. Both sprites will appear at the same level
D. Sorting order does not affect visual stacking
Solution
Step 1: Understand sorting order within the same layer
Higher sortingOrder values appear in front of lower ones within the same sorting layer.
Step 2: Compare the given sortingOrder values
spriteB has sortingOrder 7, which is higher than spriteA's 3, so spriteB appears on top.
Final Answer:
spriteB will appear on top -> Option A
Quick Check:
Higher sortingOrder = on top [OK]
Hint: Higher sortingOrder means sprite is drawn on top [OK]
Common Mistakes:
Thinking lower sortingOrder is on top
Confusing sorting layer with sorting order
Assuming sorting order has no effect
4. You set two sprites to the same sorting layer and sorting order, but one still appears behind the other unexpectedly. What is a likely cause?
medium
A. The sprite behind has a higher Z position in 3D space
B. Sorting layers override all other settings
C. Sorting order must be negative to appear on top
D. You must assign different sorting layers to fix this
Solution
Step 1: Understand sorting layers and order limits
Sorting layers and order control 2D visual stacking but Z position can still affect rendering if using 3D or perspective camera.
Step 2: Identify cause of unexpected order
If sorting layers and order are equal, the sprite with lower Z position (closer to camera) appears on top.
Final Answer:
The sprite behind has a higher Z position in 3D space -> Option A
Quick Check:
Z position affects draw order if sorting order is equal [OK]
Hint: Check Z position if sorting order is equal [OK]
Common Mistakes:
Assuming sorting layers always override Z position
Thinking sorting order must be negative
Believing different sorting layers are always required
5. You have three sprites: spriteX on sorting layer "Background" order 0, spriteY on sorting layer "Foreground" order 0, and spriteZ on sorting layer "Background" order 5. Which sprite will appear on top visually?
hard
A. spriteZ will appear on top
B. spriteY will appear on top
C. spriteX will appear on top
D. spriteX and spriteY will appear on top together
Solution
Step 1: Understand sorting layer priority
Sorting layers have a fixed order set in Unity's editor. "Foreground" layer is above "Background" layer regardless of sortingOrder values.
Step 2: Compare sprites across layers and orders
spriteY is on "Foreground" layer order 0, which is above both spriteX and spriteZ on "Background" layer, even though spriteZ has order 5.
Final Answer:
spriteY will appear on top -> Option B
Quick Check:
Sorting layer priority beats sorting order [OK]
Hint: Sorting layer priority beats sorting order [OK]
Common Mistakes:
Thinking sorting order overrides sorting layer
Ignoring sorting layer hierarchy
Assuming higher order always means on top
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.