# Event not stopping... another one

**URL:** <https://qa.fmod.com/t/event-not-stopping-another-one/20798>\
**Category:** FMOD Studio\
**Created:** [October 23, 2023, 9:25pm UTC](https://qa.fmod.com/t/event-not-stopping-another-one/20798 "2023-10-23T21:25:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johanenglund](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Johanenglund](https://qa.fmod.com/u/Johanenglund)\
**Post date:** [October 23, 2023, 9:25pm UTC](https://qa.fmod.com/t/event-not-stopping-another-one/20798/1 "2023-10-23T21:25:41Z")

</div>

Hi

I’m sure I’m being a numpty but I can’t figure out why this isn’t working. I’m starting an event in a start method and then stopping the same event in the same script but it’s not working. If I put in an else it just tells me the stop method wasn’t working. If I use an FMOD emitter (as in the image) it works but I probably need to call this separately and not via game objects. The script has the non-functional bits commented out. Thanks J

 ![trigger](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/e/e4fe3b223432d6c2fa1fa662391e6be3d71a2e75.png)  
 ![script](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/4/4cf2eff0fa94a59a93ffcd77192c2cdcd4ce5784.png)

---

<div class="post-metadata">

**Author:** ![Johanenglund](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Johanenglund](https://qa.fmod.com/u/Johanenglund)\
**Post date:** [October 24, 2023, 10:30am UTC](https://qa.fmod.com/t/event-not-stopping-another-one/20798/2 "2023-10-24T10:30:53Z")

</div>

OK I very much feel that I should have a better handle on handles 🤣  
If someone can take pity and explain this to me it’d be very helpful.  
So if I start the music in the Start method of the “MusicManager” it’ll have an invalid handle when I call it from the animation event via this UnityEvent trigger script. If I instead add an OnEnable method in that script the logic works? So does an event always have to be called from the same object?

 ![music working](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/c/cb535d0aa942af6ee755d727e897c98cb15f5be6.png)

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [October 25, 2023, 9:44pm UTC](https://qa.fmod.com/t/event-not-stopping-another-one/20798/3 "2023-10-25T21:44:41Z")

</div>

Hi,

I am a bit confused, Using your script I was able to play the event from the `start()` function. I would suggest adding some error checking in order to find where it is failing:

```auto
private void StudyMusic()
{
    studyMusic = FMODUnity.RuntimeManager.CreateInstance("event:/Music/Level 01");
    if (studyMusic.isValid())
    {
        FMOD.RESULT result = studyMusic.start();
        if (result != FMOD.RESULT.OK)
        {
            Debug.Log(result.ToString());
        }
    }
}

```

Using the `isValid()` ([FMOD Engine | Studio API reference - EventInstance](https://fmod.com/docs/2.02/api/studio-api-eventinstance.html#studio_eventinstance_isvalid)) will let us know if the `CreateInstance()` function failed. Next is `FMOD.RESULT` ([FMOD Engine | Core API Reference - FMOD\_RESULT](https://fmod.com/docs/2.02/api/core-api-common.html#fmod_result)) is returned from most FMOD functions and provides more information about why an FMOD Function may have failed.

It seems if the `StudyMusic()` function is failing there may be an issue with the path passed to the `CreateInstance()` function.

> [@Johanenglund](#):
>
> So does an event always have to be called from the same object?

Not necessarily, it should be possible. What is the object triggering the `MusicManager` in this image?

 ![music working](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/c/cb535d0aa942af6ee755d727e897c98cb15f5be6.png)

---

<div class="post-metadata">

**Author:** ![Johanenglund](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Johanenglund](https://qa.fmod.com/u/Johanenglund)\
**Post date:** [December 12, 2023, 8:35pm UTC](https://qa.fmod.com/t/event-not-stopping-another-one/20798/4 "2023-12-12T20:35:23Z")

</div>

Thanks and sorry for my late reply. This was a game jam project and somewhere along the line, the FMOD folder got moved around in the Unity project. I went back and had a look and I can only think that this is the reason for the weird behaviour.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [December 12, 2023, 9:14pm UTC](https://qa.fmod.com/t/event-not-stopping-another-one/20798/5 "2023-12-12T21:14:14Z")

</div>

Hi,

Thank you for sharing the solution. Hope the game jam went well!
