Changing NoiseAndGrain in runtime

I need to change the variables of the NoiseAndGrain image effect but am not sure how. I have the NoiseAndGrain component as a component but don’t know how to change its variables. Thank you in advance.

private var imgEffect : NoiseAndGrain;

function Start () {
player = GameObject.Find("Player").transform;
imgEffect = GameObject.Find("Camera").GetComponent(NoiseAndGrain);
}

function Update () {
imgEffect.//what do I put here???
}

http://docs.unity3d.com/Documentation/Components/script-NoiseAndGrain.html

it would appear you have available to you the properties there.

So for example you should be able to say

Debug.Log(" imgEffect.monochrome is ... " + imgEffect.monochrome );

If you just type “noise” in to your PROJECT panel, you will immediately find the script noiseandgrain

If you look in it, you will see the variables …

public var intensityMultiplier : float = 0.25f;

public var generalIntensity : float = 0.5f;
public var blackIntensity : float = 1.0f;
public var whiteIntensity : float = 1.0f;
public var midGrey : float = 0.2f;

public var dx11Grain : boolean = false;
public var softness : float = 0.0f;
public var monochrome : boolean = false;

public var intensities : Vector3 = Vector3(1.0f, 1.0f, 1.0f);
public var tiling : Vector3 = Vector3(64.0f, 64.0f, 64.0f);
public var monochromeTiling : float = 64.0f;

public var filterMode : FilterMode = FilterMode.Bilinear;
		
public var noiseTexture : Texture2D;

public var noiseShader : Shader;	

So, now you know what you can type there! :slight_smile: hope it helps