[SerializeField] private EnvironmentDepthManager _environmentDepthManager;
private IEnumerator Example()
{//Check if this feature is supported on your platform
if(!EnvironmentDepthManager.IsSupported)
{ Debug.Log("This feature is not supported");yield break;
}
//enables the feature and makes depth textures available
//depth textures will be available from the system asynchronously
_environmentDepthManager.enabled = true;
while(!_environmentDepthManager.IsDepthAvailable)
yield returnnull;
Debug.Log("Depth textures are now available);}
privatevoid ExampleOccl()
{//sets occlusion mode to "SoftOcclusion" \– this is the default value
_environmentDepthManager.OcclusionShadersMode = OcclusionShadersMode.SoftOcclusion;
//sets occlusion mode to "HardOcclusion"
_environmentDepthManager.OcclusionShadersMode = OcclusionShadersMode.HardOcclusion;
//sets occlusion mode to "None" \– it's a good idea to disable environmentDepthManager to save resources in this case
_environmentDepthManager.OcclusionShadersMode = OcclusionShadersMode.None;
//remove hands from the depth map
_environmentDepthManager.RemoveHands = true;
//disables the feature. Frees up resources by not requesting depth textures from the system
_environmentDepthManager.enabled = false;
}