首页 > 解决方案 > 通过脚本更改 PostProcessing 绽放效果

问题描述

我正在尝试通过脚本更改绽放颜色(后处理)。在检查器中颜色会发生变化,但在游戏视图中不会。请帮忙。

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;
    }
}

标签: c#unity3dpost-processing

解决方案


推荐阅读