Event State Problem

Hello, i make an event which contains loop reigon like this:


And this is callback set to event:

And here is how i post the event:

public static int PostEvent(
        string eventName, Transform tr = null,
        int delayPost = 0, int duration = 0, Action callBack = null, float volume = 1)
    {
        LoadBank(data.BankName);

        EventInstance instance;
        instance = RuntimeManager.CreateInstance(data.EventID);
        instance.setVolume(volume);
        instance.setCallback(EventCallBack);
        return instance.GetHashCode();
    }

The problem is that, when i call this event, the event will be in stopped state when the first loop reaches end but the event is still looping…
Any reason? Thank you very much!!!

The issue appears to be that the callback being checked for is EVENT_CALLBACK_TYPE.SOUND_STOPPED instead of EVENT_CALLBACK_TYPE.STOPPED. SOUND_STOPPED will fire every loop because the instrument stops at the end of the loop and is triggered again when the loop restarts. STOPPED, on the other hand, will only fire when the entire event has stopped.

1 Like

Thank you so much!