What is the best way to adjust parameters of the image effects through script?
I would like to increase the TwirlEffect angle when a collision between two objects occurs.
Cheers.
What is the best way to adjust parameters of the image effects through script?
I would like to increase the TwirlEffect angle when a collision between two objects occurs.
Cheers.
Image Effects are just scripts like any other script. So the best is getting to the image effect either by exposing a variable that you setup in the inspector:
var twirl : TwirlEffect;
Or getting the effect from camera like
twirl = camera.GetComponent(TwirlEffect);
Then you just modify it’s properties:
twirl.angle = 100.0;
I’ve tried all of these and keep getting Null reference errors, or cannot reference this this when declaring a variable errors. ![]()
//var twirl= Camera.main.GetComponent(TwirlEffect);
//var twirl : TwirlEffect;
var twirl = camera.GetComponent(TwirlEffect);
function OnCollisionEnter(collision : Collision) {
twirl.angle = 100.0;
}
Ah sweet I got it. I just had to select the main camera in the inspector. I kept trying to fing the TwirlEffect script itself.
Thanx
Now watch out for those silly mushrooms…