Hello, everyone. So, I am having a problem with making my Gamma Correction image effect script save a specific value upon restarting the Editor, or even entering Play Mode.
using UnityEngine;
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Gamma Correction")]
public class GammaCorrectionEffect : ImageEffectBase
{
public float gamma;
private new void Start()
{
base.Start();
gamma = Mathf.Clamp(SaveManager.GetFloat("Gamma"), 0.5f, 2f);
}
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
base.material.SetFloat("_Gamma", 1f / gamma);
Graphics.Blit(source, destination, base.material);
}
}
As stated before, every time I input a custom value in the Inspector, the value stays the same up until I exit or enter Play Mode.
I should note that I am using a legacy version of Unity 4.5.1f3, but interestingly enough, this has the same outcome when upgrading to newer versions (example: Unity 5.2.3).
Can someone please help? If so, it’d be a great help. Thanks in advance!