In Unity, whether it’s from code or from the editor, if I play an event with Studio Event Emitter component, the event will not replay, its just do nothing.
Is there a way to make the event either replay from start, or start another instance of the event so they get played at the same time,
for example an event for playing bullet effect, if you play the event a second time, there will be another bullet effect that get played asynchronously with the first instance.
Is the event oneshot (does it finish by itself)?
Is it detected by Unity as oneshot?
Did you limit the number of max instances of this event in FMOD Studio?
1 - honestly I don’t know what are the factors that marks the event as oneshot.
2 - yes Unity detects the event as oneshot.
3 - no.
It seems no one want to answer.
You should post a screenshot of your Studio Event Emitter Component settings, and better describe the content of your event and the wrong behavior. Does it play correctly the first time? Did you try to replay the event while the first sound is still playing? After it has stopped? etc…
I’d be happy to attach some screenshots, but I didn’t know such problem needs such details!
Yes it plays correctly the first time, the event plays correctly every time I play it as long as the event is not currently playing, the problem occurs when I want to replay the event while it still playing, but after its finished I can replay it correctly.
Hope that is enough details.
Event in studio :
as you can see the event is fairly simple.
Screenshots are useful because it can show details you forgot to mention.
I’m surprised your event is marked as “stream”, though it’s only 350 ms long. The usual practice is to set as streaming assets which are long (>10s) and not frequently accessed ; since yours is short with frequent access, it should be in RAM. Maybe that could be the reason of the lack of reactivity when playing the sound two times in a row…
Yes I marked the audio asset manually as “stream” because it is not frequently used in my situation,
however the problem resides even if the asset is marked non “stream”.
I’m assuming there is an option or setting or something that can change such behavior.
This really sounds as if you limited the instances to 1 with stealing to none, somewhere. Even though your event is correct, check each bus of the chain in the mixer view (including master) and look for such limitation. Exemple on the master bus:
All my mixer channels’ 'max instances" property are set to “infinite”.
Though I’m not a Unity user, I’ve tested the event emitter and it behaves as it should with oneshot events: it stacks another instance when replayed.
A few more ideas:
- check/update the version of Unity, FMOD and integration plugin
- recreate your Unity object from scratch
- test it with other trigger methods
- recreate your FMOD event from scratch, with other and longer assets
Sorry I’m a bit late to the party!
On the Event Emitter component it appears you do not have a Play or Stop Event selected. This could be why it is not triggering a second time, although I would be interested as to how you’re getting it to play the first time without a Play Event at least. When you start the event through code are you using .start() or .PlayOneshot()?
Yes in this example I don’t have Play or Stop Events, and I play the event via code using:
and even if the emitter has Play or Stop Events the behavior is the same.
I would replace sfx.Play() with:
FMODUnity.RuntimeManager.PlayOneShotAttached(“event path”, gameObject you want the sound attached to);
or if you just need a 2D sound:
and then remove the Event Emitter component from the Game Object in Unity. Hopefully this would work! Without seeing the code an issue may be that your sound is still playing, especially if you are not destroying or releasing the event instance then that may be the cause of your problem.
Another cause may be that your parameters are not set up right and when you change the parameters you are accidentally turning the volume of both tracks to zero. I might suggest splitting this event into two events, one for the switch on and another for off, as that might be a simpler solution than messing around with parameters (unless there are cases where you want to blend the two sounds together)