C# 通过脚本更改后处理bloom效果

C# 通过脚本更改后处理bloom效果,c#,unity3d,post-processing,C#,Unity3d,Post Processing,我正试图通过脚本更改bloom颜色(后处理)。在inspector中,颜色会发生变化,但在游戏视图中不会。请帮忙 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering.PostProcessing; public class PostProcceserManager : MonoBehaviour { PostProcessVo

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

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;
    }
}
使用系统集合;
使用System.Collections.Generic;
使用UnityEngine;
使用UnityEngine.Rendering.PostProcessing;
公共类后处理管理器:单行为
{
后处理体积;
开花层;
公共ColorParameter[]ColorArray;
私人空间
{
volume=gameObject.GetComponent();
volume.profile.TryGetSettings(输出层);
}
私有void Start()
{
//换颜色
volume.enabled=true;
ColorParameter x=新的ColorParameter();
x、 值=Color.red;
x、 不动产=真;
bloomLayer.color=x;
}
}

这里有一个类似的问题:你应该试着做他们所做的事情,看看这是否适合你。我注意到它们确实
bloomLayer.enable=true但你从来没有这样做过。也许你应该尝试一下,当它只是在编辑器中显示而不是在游戏中显示时,也许这是一个奇怪的设置,你可以在unity编辑器中设置,尝试查看编辑器/游戏窗口上方,看看是否有任何复选框可以更改。祝你好运这里有一个类似的问题:你应该试着做他们所做的事情,看看这是否对你有效。我注意到它们确实
bloomLayer.enable=true但你从来没有这样做过。也许你应该尝试一下,当它只是在编辑器中显示而不是在游戏中显示时,也许这是一个奇怪的设置,你可以在unity编辑器中设置,尝试查看编辑器/游戏窗口上方,看看是否有任何复选框可以更改。祝你好运