- Home /
Need to Access GlowEffect From Script and Add To "Intensity" Parameter
Hey everyone, thanks in advance.
so I've got a simple .js attached to my FPS player that determines when a tagged object collides, and adds to a score. I also have audio that plays, triggered by the same collision.
I now want to increase the Blur Intensity on my Main Camera by 5, when I collide with the tagged object, and have the effect's increase disappear after a few seconds. Going further, I would eventually like to have this tweened so it's not as abrupt a transition.
Below is my script:
var score = 0;
var scoreText = "Score: 0";
var MyFont : Font;
function OnTriggerEnter( other : Collider ) {
Debug.Log("OnTriggerEnter() was called");
if (other.tag == "Coin") {
Debug.Log("Other object is a coin");
score += 5;
scoreText = "Score: " + score;
Debug.Log("Score is now " + score);
yield WaitForSeconds (.2);
Destroy(other.gameObject);
}
}
I have tried a few different ideas, but this is my base script. Let me know if you can help, thanks!
Pat
To be honest, to do what you're suggesting I'd actually create an animation and add it to the camera. You are able to animate the properties of virtually any behaviour attached to your object.
Then, when you want the blur to happen, in the script you simply play the animation.
All done - using the existing animation system you could then blend animations or layer then on top of each-other, resulting in smooth transitions.
About 20 $$anonymous$$utes after I posted this, the same thought occurred to me. Thanks a bunch for the confirmation of my theory!