Effects
Rect Parallax
Move a UI layer in response to the pointer
Overview
Rect Parallax offsets a UI rectangle to create a subtle sense of depth as the pointer moves. It is the v2 name for Rect Depth.
Usage
Add Rect Parallax to the containing UI object.
Assign the child rectangle as Depth Object.
Set depth multiplier and follow speed.
Test the movement at the actual Canvas scale.
Tips
- Use different depth multipliers across layers for a parallax composition. Enable unscaled time if movement should continue while the game is paused.
- Keep movement on a separate visual child if a layout group controls the parent position.
Public API
Use RectParallax in the Evo.UI namespace.
Fields
| Name | Type | Description |
|---|---|---|
depthObject | RectTransform | Rectangle that receives the offset. |
depthMultiplier | float | Strength of the parallax movement. |
followSpeed | float | Pointer-follow response setting. |
useUnscaledTime | bool | Uses unscaled timing. |
Example
using UnityEngine;
using Evo.UI;
public class RectParallaxExample : MonoBehaviour
{
[SerializeField] private RectParallax target;
private void Start()
{
target.depthMultiplier = 0.08f;
target.useUnscaledTime = true;
}
}