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

**URL:** <https://qa.fmod.com/t/how-to-link-a-parameter-to-a-health-value-in-unity/13150>\
**Category:** Unity\
**Created:** [May 1, 2017, 7:22pm UTC](https://qa.fmod.com/t/how-to-link-a-parameter-to-a-health-value-in-unity/13150 "2017-05-01T19:22:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jackquinton](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@Jackquinton](https://qa.fmod.com/u/Jackquinton)\
**Post date:** [May 1, 2017, 7:22pm UTC](https://qa.fmod.com/t/how-to-link-a-parameter-to-a-health-value-in-unity/13150/1 "2017-05-01T19:22:10Z")

</div>

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 [https://gist.github.com/anonymous/b65b9d72270bfdb7f300a5a7ca99d0c7](https://gist.github.com/anonymous/b65b9d72270bfdb7f300a5a7ca99d0c7)

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

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [May 2, 2017, 12:54am UTC](https://qa.fmod.com/t/how-to-link-a-parameter-to-a-health-value-in-unity/13150/2 "2017-05-02T00:54:01Z")

</div>

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()](https://www.fmod.org/docs/content/generated/FMOD_Studio_ParameterInstance_SetValue.html).  
Here is an example using [event-\>setParamaterValue()](http://www.fmod.org/documentation/#content/generated/engine_new_unity/script_example_basic.html).
