Revealer API
FogOfWarRevealer (namespace FOW) is the abstract base for Revealer 3D and Revealer 2D. Raycast-based revealers also expose the additional properties from RaycastRevealer.
Properties
All of these are runtime get/set properties — setting one re-applies the revealer's data to the GPU.
| Property | Type | Description |
|---|---|---|
ViewRadius |
float | Sight range. |
SoftenDistance |
float | Outer edge softening. |
InnerSoftenAngle |
float | Inner cone softening. |
UnobscuredRadius |
float | Always-lit radius. |
UnobscuredSoftenDistance |
float | Unobscured radius softening. |
VisionHeight |
float | Vision height (3D). |
VisionHeightSoftenDistance |
float | Vision height softening. |
ViewAngle |
float | Vision cone angle (1–360). |
Opacity |
float | Reveal strength (0–1). |
RevealHiderInFadeOutZonePercentage |
float | Hider reveal threshold in the soften zone. |
UseOcclusion |
bool | Whether obstacles block vision. |
AddCorners |
bool | Add object corners as segments. |
Raycast revealer (3D/2D) additions: RaycastResolution, NumExtraIterations, NumExtraRaysOnIteration, ResolveEdge, MaxEdgeResolveIterations, EdgeDstThreshold, DoubleHitMaxAngleDelta, OcclusionQuality. See Occlusion Quality.
Public fields: EyeOffset, ShaderEyeOffset, StartRevealerAsStatic.
Read-only: CurrentlyStaticRevealer (bool), TotalRevealerRadius (float), RevealerArrayPosition (int), RevealerGPUDataPosition (int).
Methods
SetRevealerAsStatic
public void SetRevealerAsStatic(bool isStatic)
Marks the revealer as static (or not). A static revealer stops recalculating line of sight automatically.
ManualCalculateLineOfSight
public void ManualCalculateLineOfSight()
Forces a full line-of-sight recalculation now. Use this for static revealers whose surroundings changed, or with the Manual Updates update mode.
TestPoint
public bool TestPoint(float3 point)
Returns true if the given point is within this revealer's line of sight.
RegisterRevealer / DeregisterRevealer
public void RegisterRevealer()
public void DeregisterRevealer()
Manually add or remove the revealer from the system. This normally happens automatically in OnEnable / OnDisable.
Events
OnHiderVisibilityChanged
public event Action<FogOfWarHider, bool> OnHiderVisibilityChanged
Raised when this revealer gains or loses sight of a hider. See Hider Visibility Events.
Example
using FOW;
using UnityEngine;
public class RevealerControl : MonoBehaviour
{
FogOfWarRevealer revealer;
void Awake() => revealer = GetComponent<FogOfWarRevealer>();
public void Blind() => revealer.ViewRadius = 0;
public void Freeze() => revealer.SetRevealerAsStatic(true);
}