Change PostProcessing bloom effect via script

♀尐吖头ヾ 提交于 2021-01-28 08:12:47

问题


I'm trying to change the bloom color (PostProcessing) via a script. In the inspector the color changes but not in the game view. Some help, please.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

public class PostProcceserManager : MonoBehaviour
{
    PostProcessVolume volume;
    Bloom bloomLayer;

    public ColorParameter [] ColorArray;

    private void Awake()
    {
        volume = gameObject.GetComponent<PostProcessVolume>();
        volume.profile.TryGetSettings(out bloomLayer);
    }

    private void Start()
    {
        //change the color
        volume.enabled = true;
        ColorParameter x = new ColorParameter();
        x.value = Color.red;
        x.overrideState = true;
        bloomLayer.color = x;
    }
}

来源:https://stackoverflow.com/questions/58652614/change-postprocessing-bloom-effect-via-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!