Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+1)
//You need a post processing stack for this script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
public class PostProcessController : MonoBehaviour
{
    //From other script change a neededLensDist;
    
    [SerializeField] PostProcessVolume volume; //Variable of postprocessing volume
    private LensDistortion lens = null; //Variable of lens distortion (module in post processing profile)
    public float neededLensDist = 0; //Needed value for lens distortion
    private void Awake()
    {
        volume.profile.TryGetSettings(out lens); //Get a lensDistortion variable for changing it
    }
    void Update()
    {
        //Smooth changing lens distortion
        lens.intensity.value = Mathf.Lerp(lens.intensity.value, neededLensDist, 0.025f);
    }
}