API referenceAutoDepthOfFieldAPI static API

AutoDepthOfFieldAPI static API

Control PBADOF lifecycle, presets, override volume state, and focus solving through the AutoDepthOfFieldAPI static compatibility facade.

AutoDepthOfFieldAPI static API

HIBIKI entertainment's AutoDepthOfFieldAPI class is a static compatibility facade that provides convenience access to PBADOF lifecycle management, preset operations, override volume state, and focus-solving helpers. It forwards to the active AutoDepthOfField component when one is available.

The API facade methods forward to the active output-owning AutoDepthOfField component. If no component is active, methods silently no-op or return default values. For direct component access, use AutoDepthOfField.TryGetCurrent instead.

Output and lifecycle

MethodParametersDescription
SetupDOFVolume(Volume, VolumeProfile, float)volume: target Volume, profile: VolumeProfile asset, blendWeight: blend weight (default 1)Configures a Unity Volume with the supplied profile and blend weight.
UpdateGlobalFocalLength(float)value: focal length in millimetresUpdates the global focal length on the active component.
SetSystemState(bool)isActive: desired stateActivates or deactivates the PBADOF system.
SetDepthOfFieldRenderState(bool)isActive: desired stateActivates or deactivates the depth-of-field render pass.
SetDepthOfFieldQuality(DepthOfFieldQualityData)quality: quality data assetSets the rendering quality for the depth-of-field effect.
StartFocalLengthUpdate()NoneBegins the focal-length update cycle on the active component.

Presets

MethodParametersDescription
ApplyPreset(DepthOfFieldPreset)preset: the preset to applyApplies the given preset to the active component.
SavePreset(DepthOfFieldPreset)preset: the preset to saveSaves the active component's current settings into the given preset asset.
GetDefaultPreset()NoneReturns the built-in default preset.

Override volume state

MethodParametersDescription
SetIsInVolume(bool, AutoDepthOfFieldVolumeData)inVolume: whether inside a volume, data: volume dataReports volume-entered state with explicit volume data.
SetIsInVolume(bool)inVolume: whether inside a volumeReports volume-entered state without explicit data.
SetAimingState(bool)value: aiming stateSets the aim-down-sight state for ADS volume resolution.
BuildOverrideVolumes(bool)ignoreCheckTime: skip time-based throttleRebuilds the override volume database.
CreateADSVolume()NoneCreates and returns a new ADS override volume.
CreateADSVolume(AutoDepthOfField)owner: explicit owner componentCreates a new ADS volume with a specified owner.
CreateAdvancedVolume()NoneCreates and returns a new CameraFallback override volume.
CreateAdvancedVolume(AutoDepthOfField)owner: explicit owner componentCreates a new CameraFallback volume with a specified owner.
CreateOverrideVolume(Vector3, Vector3, Vector3, DepthOfFieldPreset, string, bool)volumePosition, volumeSize, volumeRotation, preset, volumeName, showGizmosCreates a spatial override volume with full configuration. Returns the volume data.
GetCurrentVolumeData(Dictionary<int, AutoDepthOfFieldVolumeData>)database: volume databaseReturns the data for the currently active volume.
AddVolumeToDatabase(int, AutoDepthOfFieldVolumeData)ID: volume ID, data: volume dataAdds a volume to the database.
RemoveVolumeToDatabase(int)ID: volume IDRemoves a volume from the database.
CacheAllSceneVolumeColliders(AutoDepthOfFieldData)data: component dataCaches colliders for all scene volumes.
ResetAllVolumesDOFEnabledValues()NoneResets the DOF-enabled flag on all volumes.

Focus compatibility helpers

MethodParametersDescription
CalculateFocusPoint(Camera, AutoDepthOfFieldData, float, float, RaycastHit[], float, out float, out int, bool)mainCamera, data, fov, maxDistance, glassResults (retained for compatibility, not used as shared state), glassCorrection, out groundDistance, out closestRay, clearCacheCalculates the focus point using the component-owned solver. Returns the focus distance.
AssignRaycastHit(AutoDepthOfFieldData, ref RaycastHit, Vector3, bool)data, ref raycastHit, playerPosition, sortClosestAssigns a raycast hit to the focus solver. Returns success.
TagCheck(RaycastHit, List<string>, bool)hit, tags, useTagCheckChecks whether a hit's tag is in the allowed list. Returns the match result.
CheckClosest(Camera, float, RaycastHit, int, out int)mainCamera, oldValue, raycast, rayID, out closestRayCompares a raycast against the current closest hit. Returns the distance.

The CalculateFocusPoint method retains the glassResults parameter for source and binary compatibility, but the implementation forwards to the component-owned solver and does not use it as shared solver state.

Editor-only members

MemberTypeDescription
CacheTags()Method (editor-only)Populates the internal tag cache from Unity's editor tag list. Only compiled in the Unity Editor.

Public static fields

FieldTypeDescription
RaycastCacheLimitintMaximum number of cached raycast hits.
m_cachedRaycastHitsRaycastHit[]Cached raycast hit buffer.

Usage examples

// Activate the PBADOF system
AutoDepthOfFieldAPI.SetSystemState(true);

// Set quality
AutoDepthOfFieldAPI.SetDepthOfFieldQuality(myQualityData);

// Update focal length
AutoDepthOfFieldAPI.UpdateGlobalFocalLength(50f);

Next steps

See the AutoDepthOfField component for the main component API, or the Override volume and focus proxy API for component-level volume and proxy interfaces.