How to link a parameter to a health value in unity?

(Jack) #1

I’ve been following the survival shooter tutorial and now I’m trying to introduce a heartbeat event as a parameter named “Health” as the players health goes under 40%

My script is bellow

I think i’ve currently called the event but it’s just linking the “Health” paramiter value to the “Currenthealth”

(Cameron Baron) #2

At the moment you have it set to play every time the player takes damage while Health <= 40. If it is a looping sound you would only want it to play once, then adjust the parameter to change the sound of the event accordingly.

You can get a reference to a parameter from the event and then call setValue().
Here is an example using event->setParamaterValue().