# Parameter not responding.

**URL:** <https://qa.fmod.com/t/parameter-not-responding/12872>\
**Category:** Unity\
**Created:** [December 13, 2016, 8:57pm UTC](https://qa.fmod.com/t/parameter-not-responding/12872 "2016-12-13T20:57:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AntonV](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@AntonV](https://qa.fmod.com/u/AntonV)\
**Post date:** [December 13, 2016, 8:57pm UTC](https://qa.fmod.com/t/parameter-not-responding/12872/1 "2016-12-13T20:57:20Z")

</div>

So I have this script which is meant to trigger a multi sound in fmod.  
In FMOD I have set it up so it trigger the sound when you are close to it (2ft) .  
It seems that when I first star the game, the player lands at 2ft, so I get sound. 🙂  
But when I walk away and go back to the trigger point the sound doesn’t play again. I am pretty sure everything is set up correctly in FMOD, but there might be a problem with the script.

It seems to me that it doesn’t receive the values after the instant start. 😕

Here’s the code if anyone can help, Tnxx ! :

using UnityEngine;  
using System.Collections;

public class testDistance : MonoBehaviour {

```
public Transform player;

FMOD.Studio.EventInstance testDistanceEvent; 
FMOD.Studio.ParameterInstance distance;

Vector2 direction;
public float Distance;

void Start (){

	testDistanceEvent = FMODUnity.RuntimeManager.CreateInstance ("event:/testDistance");
	testDistanceEvent.getParameter ("Distance", out distance);
	testDistanceEvent.start();

}
void Update () {
	
	

float dist = Vector3.Distance(transform.position, player.position);
	float diz;
	//Distance.setValue (dist);
	//Distance.getValue (out float diz);

	testDistanceEvent.setParameterValue ("Distance", dist);
	testDistanceEvent.getParameterValue ("Distance", out diz);

	Debug.Log (dist);

}

```

}

---

<div class="post-metadata">

**Author:** ![AntonV](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@AntonV](https://qa.fmod.com/u/AntonV)\
**Post date:** [December 13, 2016, 11:24pm UTC](https://qa.fmod.com/t/parameter-not-responding/12872/2 "2016-12-13T23:24:44Z")

</div>

This is another simplified version I tried but doesn’t work either. 😕  
using UnityEngine;  
using System.Collections;

public class testDistance : MonoBehaviour {

```
public Transform player;
public string position; 

FMOD.Studio.EventInstance testDistanceEvent; 
FMOD.Studio.ParameterInstance distance;

[Range(0, 10)] public float Distance;

void Start (){

	testDistanceEvent = FMODUnity.RuntimeManager.CreateInstance("event:/testDistance");
	testDistanceEvent.getParameter("Distance", out distance);
	testDistanceEvent.start();

}
void Update () {

	float dist = Vector3.Distance(transform.position, player.position);
	distance.setValue(dist);
	Distance = dist; 
	Debug.Log (dist);

}

```

}

---

<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:** [December 14, 2016, 2:16am UTC](https://qa.fmod.com/t/parameter-not-responding/12872/3 "2016-12-14T02:16:00Z")

</div>

Your code looks fine and displays the correct values.  
You mention triggering the sound but this code only plays on startup, either you may need a loop region on your event or use triggers to play the sound again.

---

<div class="post-metadata">

**Author:** ![AntonV](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@AntonV](https://qa.fmod.com/u/AntonV)\
**Post date:** [December 14, 2016, 11:30pm UTC](https://qa.fmod.com/t/parameter-not-responding/12872/4 "2016-12-14T23:30:58Z")

</div>

> [@](#):
>
> Your code looks fine and displays the correct values.  
> You mention triggering the sound but this code only plays on startup, either you may need a loop region on your event or use triggers to play the sound again.

Thanks a lot Cameron ! All I needed to do was to make a small loop in the timeline(FMOD). I forgot to do so because I was mainly working on the distance parameter. Thanks again! 🙂
