Max Instances and EventInstance creation

Hi all, FMOD novice here.

I was wondering how creating event instances with FMODUnity.RuntimeManager.CreateInstance handles Max Instances, in particular when the “Stealing” setting is set to None and the max number of instances has been reached.

Is there a way to tell that the max instances has been reached? In my code I am doing some additional work after creating the event instance, but if the event isn’t going to be played because it hit the max instances, I would like to abort since there isn’t any reason to do any more work.


FMOD will dynamically make voices virtual or real depending on real time audibility, see the docs for info on audibility calculation.

The events will still be played although they may just be virtual when they start, you can query Studio::EventInstance::isVirtual.

More information about the virtual voice system can be found in the docs:

Thanks, the stealing concept is making more sense to me now.

I am still a little confused, though. For testing I set Max Instances to 1 and Stealing to None. I would expect that if I check isVirtual after creating each event instance, the 1st one would be false, and all others created after would be true until the 1st event instance finishes. However all of my event instances say that isVirtual is false.

By this do you mean that they all always return this or each of them after creating them will return this?

So this is basically what my code is doing, playing one-shot audio on collision (I’ve removed a bunch of parts not related to FMOD):

private void OnCollisionEnter()
      fmodEventInstance = FMODUnity.RuntimeManager.CreateInstance("MyEvent");

      bool isVirtual;
      fmodEventInstance.isVirtual(out isVirtual);


If I have this attached to say 100 objects with the same settings I mentioned in my previous post, the sounds play correctly, only allowing 1 instance, but the Debug.Log will always say false. I’ve checked the result returned by isVirtual and there’s nothing wrong there.

If you set the stealing to ‘None’ then no new event instances can be played until the existing event instance stops, meaning that they aren’t virtual because they aren’t even playing.

Ok, so based on that I would think that getPlaybackState could tell me whether or not the event instance actually started playing (regardless of whether or not it is virtual).

Testing it out, though, I always get a result of FMOD_STUDIO_PLAYBACK_STARTING, so I guess I can’t immediately determine if the event will play or not?

You could use StudioSystem::flushCommands after starting the Event to force the system to update and process the Event, although this function does block the calling thread.