# Help with Parameters

**URL:** https://qa.fmod.com/t/help-with-parameters/15721
**Category:** FMOD Studio
**Created:** [May 4, 2020, 8:40am UTC](https://qa.fmod.com/t/help-with-parameters/15721 "2020-05-04T08:40:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![namoona](https://avatars.discourse-cdn.com/v4/letter/n/13edae/32.png) [@namoona](https://qa.fmod.com/u/namoona)
#### Post date: [May 4, 2020, 8:40am UTC](https://qa.fmod.com/t/help-with-parameters/15721/1 "2020-05-04T08:40:30Z")

</div>

Hello wonderful people of the FMod community.

I’m having some trouble with a simple script.  
I’ve got an Fmod event called ‘Ambience’ with a Parameter called ‘Height’ which adds wind sounds to the ambience.  
I want the ‘Height’ to relate to the Y axis position of my player in Unity. Can someone pls help me with this script?

Thanks!

---

<div class="post-metadata">

### Author: ![niu](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/niu/32/144_2.png) [@niu](https://qa.fmod.com/u/niu)
#### Post date: [May 7, 2020, 1:09pm UTC](https://qa.fmod.com/t/help-with-parameters/15721/2 "2020-05-07T13:09:40Z")

</div>

I am no programmer, but I’ll give it a try.  
Basically what you need to do is to get the height value of your player from the Y position of the Transform component on your Player GameObject. Then you should pass that value to the “Height” parameter in your FMOD event.  
Here’s how I would do it:

```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class YourScript : MonoBehaviour
{
    public Transform myTransform;

    void Start()
    {
        myTransform = GetComponent<Transform>();
    }

    void FixedUpdate()
    {
        //you can probably do this in Update() as well
        float playerHeight = myTransform.position.y;

        //check the value on the console
        Debug.Log(playerHeight);

        //apply the value to FMOD parameter
        var emitter = GetComponent<FMODUnity.StudioEventEmitter>();
        emitter.SetParameter("Height", playerHeight);
    }
}

```

Maybe there’s a more efficient way to do it, but it should work.

---

<div class="post-metadata">

### Author: ![alexzzen](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alexzzen/32/6825_2.png) [@alexzzen](https://qa.fmod.com/u/alexzzen)
#### Post date: [May 7, 2020, 3:09pm UTC](https://qa.fmod.com/t/help-with-parameters/15721/3 "2020-05-07T15:09:36Z")

</div>

That looks good, but you can cache the Studio Event Emitter in Start() instead of calling GetComponent() in FixedUpdate() 🙂

---

<div class="post-metadata">

### Author: ![niu](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/niu/32/144_2.png) [@niu](https://qa.fmod.com/u/niu)
#### Post date: [May 7, 2020, 3:45pm UTC](https://qa.fmod.com/t/help-with-parameters/15721/4 "2020-05-07T15:45:25Z")

</div>

Right, that makes sense. Thanks!
