# 4. Scripting Volume Overrides Part of [[Post-Processing]]. Previous: [[3. Worked Example - Grade Damage and a Cave]]. Next: [[5. HDRP Comparison]]. > [!note] Verification status > `Volume.profile` vs `Volume.sharedProfile` is the standard Volume API (clone vs shared asset). `VolumeProfile.TryGet<T>` and `VolumeParameter.overrideState` / `.value` are the usual hooks. **Confirm type names and parameter fields** in your URP package's Scripting API if compilation fails. **Code not compiled in Unity.** ## 4.1 `profile` versus `sharedProfile` | Accessor | Meaning | |---|---| | `volume.sharedProfile` | The asset on disk. Changing it changes every volume that uses it, and the change persists unless you revert. | | `volume.profile` | A **runtime copy**. First access clones. Safe to mutate in Play Mode; costs a bit of memory; does not automatically write back. | Art direction in the Editor: assign assets, tweak in the Inspector, commit the YAML. Runtime gameplay (hurt, drunk, underwater): **clone** (`profile`) or blend **Weight** on a volume whose profile you never mutate. If you assign `volume.profile = otherProfile`, you are pointing this component at a profile instance — know whether that instance is an asset or a clone. ## 4.2 Get, override, set ```csharp using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; void TuneBloom(Volume volume, float intensity) { if (!volume.profile.TryGet(out Bloom bloom)) bloom = volume.profile.Add<Bloom>(true); bloom.intensity.overrideState = true; bloom.intensity.value = intensity; } ``` `Add<T>` is the usual way to ensure an override exists on a *clone*. Do not add overrides to a shared project profile at runtime from gameplay code. If `Add` is not available on your version's `VolumeProfile`, create the override in the asset in the Editor and only `TryGet` at runtime (the safer teaching path). Always set `overrideState = true` on a parameter you intend to drive, or the volume system may ignore your `.value`. ## 4.3 Prefer weight, then parameters Animating **Weight** on a ready-made profile is simpler and cheaper to reason about than writing every parameter from code. Use parameters when a continuous value (health, depth, drunk-o-meter) must map onto one slider. Priority is for "which volume wins," not for animation. Do not animate Priority every frame. ## 4.4 Timeline and Cinemachine A cutscene can enable a Global volume and lerp its weight, or use a Timeline signal to switch looks ([[Timeline Basics]]). Cinemachine Impulse remains the shake ([[Cinemachine 3]]). A "drunk" camera is often a little Impulse noise plus a little Lens Distortion — measure it, then decide if the distortion is worth the pass. ## Official docs - Volumes in URP: https://docs.unity.com/en-us/engine/6000.5/manual/post-processing-and-full-screen-effects/urp/volumes-landing-page