# FMOD Unity - Parameter and Distance

**URL:** <https://qa.fmod.com/t/fmod-unity-parameter-and-distance/14098>\
**Category:** Unity\
**Created:** [September 13, 2018, 2:33am UTC](https://qa.fmod.com/t/fmod-unity-parameter-and-distance/14098 "2018-09-13T02:33:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![estebanlggr](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@estebanlggr](https://qa.fmod.com/u/estebanlggr)\
**Post date:** [September 13, 2018, 2:33am UTC](https://qa.fmod.com/t/fmod-unity-parameter-and-distance/14098/1 "2018-09-13T02:33:12Z")

</div>

Hi! I am learning about the implementation of FMOD in Unity. I have the next doubt:

I have in the FMOD project the background music and a parameter than introduces a vocal layer.

I want him to change the parameter in relation to the Player’s distance with a church.  
¿Some idea?  
Thanks!

---

<div class="post-metadata">

**Author:** ![joseph](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joseph/32/264_2.png) [@joseph](https://qa.fmod.com/u/joseph)\
**Post date:** [September 14, 2018, 5:35am UTC](https://qa.fmod.com/t/fmod-unity-parameter-and-distance/14098/2 "2018-09-14T05:35:23Z")

</div>

The simplest method would be to regularly calculate the distance between the player and the nearest church, and to update the value of the parameter to that calculated value every frame.

Information on how to set a parameter value in Unity can be found here: [https://www.fmod.com/resources/documentation-api?page=content/generated/engine\_new\_unity/paramtrigger.html#/](https://www.fmod.com/resources/documentation-api?page=content/generated/engine_new_unity/paramtrigger.html#/)

For examples of how to set an event instance’s parameter value in Unity, see:  
[https://www.fmod.org/questions/question/controlling-parameters-in-unity/](https://www.fmod.org/questions/question/controlling-parameters-in-unity/)  
[https://www.fmod.org/questions/question/set-fmod-parameter-with-ontriggerenter-in-unity-5/](https://www.fmod.org/questions/question/set-fmod-parameter-with-ontriggerenter-in-unity-5/)

---

<div class="post-metadata">

**Author:** ![estebanlggr](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@estebanlggr](https://qa.fmod.com/u/estebanlggr)\
**Post date:** [September 14, 2018, 3:41pm UTC](https://qa.fmod.com/t/fmod-unity-parameter-and-distance/14098/3 "2018-09-14T15:41:24Z")

</div>

> [@](#):
>
> The simplest method would be to regularly calculate the distance between the player and the nearest church, and to update the value of the parameter to that calculated value every frame.
> 
> Information on how to set a parameter value in Unity can be found here: [https://www.fmod.com/resources/documentation-api?page=content/generated/engine\_new\_unity/paramtrigger.html#/](https://www.fmod.com/resources/documentation-api?page=content/generated/engine_new_unity/paramtrigger.html#/)
> 
> For examples of how to set an event instance’s parameter value in Unity, see:  
> [controlling parameters in Unity - Unity - FMOD Forums](https://www.fmod.org/questions/question/controlling-parameters-in-unity/)  
> [Set FMOD Parameter with OnTriggerEnter in Unity 5 - Unity - FMOD Forums](https://www.fmod.org/questions/question/set-fmod-parameter-with-ontriggerenter-in-unity-5/)

Great! Right now I’m doing some tests 😃  
Thank you so much!
