hi, I have completed my tower defence game, I want to add a cutscene in-game at the start of my game scene in which I want to modify the value of depth of field in a cutscene but I don’t know how to do it using script or timeline
here’s my code that didn’t work
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
public class CurScene : MonoBehaviour
{
[SerializeField] DepthOfField depthOfField;
[SerializeField] LensDistortion lensDistortion;
[SerializeField] float depthOfFieldClearValue = 25;
bool done = false;
// Start is called before the first frame update
private void Awake()
{
depthOfField = FindObjectOfType<DepthOfField>();
lensDistortion = FindObjectOfType<LensDistortion>();
}
void Start()
{
StartCoroutine(controlEffects());
}
IEnumerator controlEffects()
{
while (!done)
{
Debug.Log("start");
if (depthOfField.focusDistance.value < depthOfFieldClearValue)
{
depthOfField.focusDistance.value ++;
}
lensDistortion.intensity.value++;
if(lensDistortion.intensity.value > 0)
{
done = true;
}
yield return new WaitForSeconds(.1f);
}
}
}
this code is supposed to increase focus distance and intensity but it doesn’t change any value in the post-processing effect