# Cannot change parameter on Studio Event Emitter Object.

**URL:** <https://qa.fmod.com/t/cannot-change-parameter-on-studio-event-emitter-object/13435>\
**Category:** Unity\
**Created:** [September 15, 2017, 4:43am UTC](https://qa.fmod.com/t/cannot-change-parameter-on-studio-event-emitter-object/13435 "2017-09-15T04:43:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laustin\_Spayce](https://avatars.discourse-cdn.com/v4/letter/l/90ced4/32.png) [@Laustin\_Spayce](https://qa.fmod.com/u/Laustin_Spayce)\
**Post date:** [September 15, 2017, 4:43am UTC](https://qa.fmod.com/t/cannot-change-parameter-on-studio-event-emitter-object/13435/1 "2017-09-15T04:43:30Z")

</div>

I’ve searched high and low and everywhere and this SHOULD work. But it’s not, and I’m tearing my hair out about it.

Basically I have an emitter tied to a boat object. There’s a parameter attached to it called “boatSpeed”, basically the splashy sounds get louder the faster the boat goes. So far so good.

Here’s the event emitter attached to my boat object inside Unity.

> **[Screenshot](https://prnt.sc/glcli0)**
>
> Captured with Lightshot

And now for some scripts:

I declare the following variables:  
private FMODUnity.StudioEventEmitter m\_BoatSoundEmitter;  
private float m\_CurrentSpeed; // current speed of the boat.  
private float m\_TargetSpeed; // Target Speed of boat.  
private Rigidbody m\_CameraTarget;  
private float speedRatio;

```
void Start ()
{
	m_BoatSoundEmitter = GetComponent<FMODUnity.StudioEventEmitter>();
	m_BoatSoundEmitter.SetParameter("speed", 0.0f);
}

```

This makes sense as at the beginning the boat is stationary.  
Now every Update I call functions to move the boat:

```
void Update () 
{
	GetTargetSpeed();
	MoveBoat();
	TurnBoat();
	SetTrail();
	SetSound();
}

void SetSound()
{
	speedRatio = m_CurrentSpeed / m_MaxSpeed;
	m_BoatSoundEmitter.SetParameter("boatSpeed", speedRatio);
}

```

The only solution I can think of is to scrap using the Event Emitter inside Unity, and create an EventInstance by script and adjust that manually.

---

<div class="post-metadata">

**Author:** ![Laustin\_Spayce](https://avatars.discourse-cdn.com/v4/letter/l/90ced4/32.png) [@Laustin\_Spayce](https://qa.fmod.com/u/Laustin_Spayce)\
**Post date:** [September 15, 2017, 4:58am UTC](https://qa.fmod.com/t/cannot-change-parameter-on-studio-event-emitter-object/13435/2 "2017-09-15T04:58:24Z")

</div>

Instead of using the emitter inside Unity I instead created a script to handle the boat sound. It creates a sound instance and attached it to the Rigidbody:

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

public class BoatSound : MonoBehaviour {

[FMODUnity.EventRef]
public string m_BoatAmbience = "event:/Environment/Boat Ambience";
private BoatMover m_BoatMover;
private FMOD.Studio.EventInstance m_BoatAmbienceEvent; //rolling event
private FMOD.Studio.ParameterInstance m_BoatSpeedParameter; //speed param object
private float m_BoatSpeedRatio;
private Rigidbody m_BoatRigidBody;

void Start () {
	m_BoatMover = GetComponent<BoatMover>();
	m_BoatRigidBody = GetComponent<Rigidbody>();
	m_BoatAmbienceEvent = FMODUnity.RuntimeManager.CreateInstance(m_BoatAmbience);
	m_BoatAmbienceEvent.getParameter("boatSpeed", out m_BoatSpeedParameter);
	m_BoatAmbienceEvent.start();
	FMODUnity.RuntimeManager.AttachInstanceToGameObject(m_BoatAmbienceEvent, this.transform, m_BoatRigidBody);
	m_BoatSpeedParameter.setValue(0.0f);
}

void Update () {
	m_BoatSpeedRatio = m_BoatMover.m_CurrentSpeed / m_BoatMover.m_MaxSpeed;
	m_BoatSpeedParameter.setValue(m_BoatSpeedRatio);
}

void OnDestroy ()
{
	m_BoatAmbienceEvent.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
}

```

}

---

<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:** [September 17, 2017, 11:59pm UTC](https://qa.fmod.com/t/cannot-change-parameter-on-studio-event-emitter-object/13435/3 "2017-09-17T23:59:47Z")

</div>

There was a bug where if the parameter checkbox was not ticked in the editor, using SetParameter would not work. This has been fixed in 1.09.08.
