# EventInstance isn't valid when referencing it after instantiation

**URL:** <https://qa.fmod.com/t/eventinstance-isnt-valid-when-referencing-it-after-instantiation/23235>\
**Category:** Unity\
**Tags:** unity, csharp\
**Created:** [August 12, 2025, 11:12am UTC](https://qa.fmod.com/t/eventinstance-isnt-valid-when-referencing-it-after-instantiation/23235 "2025-08-12T11:12:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prompegutt](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prompegutt](https://qa.fmod.com/u/prompegutt)\
**Post date:** [August 12, 2025, 11:12am UTC](https://qa.fmod.com/t/eventinstance-isnt-valid-when-referencing-it-after-instantiation/23235/1 "2025-08-12T11:12:46Z")

</div>

I have a class that instantiates objects with a StudioEventEmitter on it. I’m trying to modify a parameter on an EventInstance after instantiation, however it isn’t valid for some reason. The event is one shot.

From Character.cs. FmodEventInstance here is not valid.

> private void HitSound(Character victim, bool isCrit)  
> {  
> var slashSound = Instantiate(slash);  
> slashSound.transform.position = victim.transform.position;  
> var FmodEventInstance = slashSound.GetComponent().EventInstance;  
> FmodEventInstance.setParameterByName(“CriticalBool”, 1f);  
> }

From SlashAudio.cs. This one is valid. It is attached to the instantiated object.

> private EventInstance FmodEventInstance;
> 
> void Start()  
> {  
> FmodEventInstance = GetComponent().EventInstance;
> 
> var pitchParameter = Random.Range(0f, 1f); FmodEventInstance.setParameterByName(“Pitch”, pitchParameter);
> 
> }

Can anyone let me know why the top one doesn’t work? And how I can get it to work? Thanks.

Edit: For some reason it won’t let me add StudioEventEmitter to GetComponent in this text editor, just pretend that’s there.

---

<div class="post-metadata">

**Author:** ![prompegutt](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prompegutt](https://qa.fmod.com/u/prompegutt)\
**Post date:** [August 12, 2025, 11:46am UTC](https://qa.fmod.com/t/eventinstance-isnt-valid-when-referencing-it-after-instantiation/23235/2 "2025-08-12T11:46:50Z")

</div>

Fixed it by setting the emitter on the prefab to not play on awake, and then running Play() followed by SetParameter() on the emitter, as opposed to on the EventInstance.
