void OnTriggerEnter(Collider other) { if (cameraInside || targetFog == null) { return; } // Check if other collider has the main camera attached if (other == targetCollider || other.gameObject.transform.GetComponentInChildren <Camera> () == targetFog.fogCamera) { cameraInside = true; if (enableProfileTransition && targetProfile != null) { targetFog.SetTargetProfile(targetProfile, transitionDuration); } if (enableAlphaTransition) { targetFog.SetTargetAlpha(targetFogAlpha, targetSkyHazeAlpha, transitionDuration); } if (enableFogColorTransition) { targetFog.SetTargetColors(targetFogColor1, targetFogColor2, transitionDuration); } if (debugMode) { Debug.Log("Fog Volume entered by " + other.name); } } }
void OnTriggerEnter(Collider other) { if (cameraInside) { return; } // Check if other collider has the main camera attached if (other.gameObject.transform.GetComponentInChildren <Camera>() == fog.fogCamera) { cameraInside = true; fog.SetTargetAlpha(targetFogAlpha, targetSkyHazeAlpha, transitionDuration); } }