# StudioEventEmitter.SetParameter creates Garbage

**URL:** <https://qa.fmod.com/t/studioeventemitter-setparameter-creates-garbage/13177>\
**Category:** Unity\
**Created:** [May 12, 2017, 6:06pm UTC](https://qa.fmod.com/t/studioeventemitter-setparameter-creates-garbage/13177 "2017-05-12T18:06:39Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![DigitalDNA](https://avatars.discourse-cdn.com/v4/letter/d/ea666f/32.png) [@DigitalDNA](https://qa.fmod.com/u/DigitalDNA)\
**Post date:** [May 17, 2017, 10:50pm UTC](https://qa.fmod.com/t/studioeventemitter-setparameter-creates-garbage/13177/6 "2017-05-17T22:50:08Z")

</div>

Here is the dirt simplest way. Just install a cache between the parameters

public static class FmodFix  
{  
private static Dictionary\<string, byte[]\> StringTable = new Dictionary\<string, byte[]\>();  
public static byte[] Encode(string name)  
{  
byte[] results;  
if (!StringTable.TryGetValue(name, out results))  
{  
results = Encoding.UTF8.GetBytes(name + Char.MinValue);  
StringTable[name] = results;  
}  
return results;  
}

}

```
    public RESULT setParameterValue(string name, float value)
    {
        return FMOD_Studio_EventInstance_SetParameterValue(rawPtr, FmodFix.Encode(name), value);
    }
```

---

_[View the full topic](https://qa.fmod.com/t/studioeventemitter-setparameter-creates-garbage/13177)._
