Calling events as string

Hi there!
I’ve been playing audios with the following line:
FMODUnity.RuntimeManager.CreateInstance(“event full address and name”);
My problem is that my audio buddy changes the event address sometimes, and I was complaining that I need the event address to stay the same, but - he told me that just the event name (and not the address) should be enough to play the correct audio.

May someone give me a light on this? Because the CreateInstance surely looks to prefer a full event path to work, but I dont feel confortable pointing finger to someone who already works with audio on the industry.

Hi!

You will either need the event’s path, or its GUID, to play the event. There’s no way to create an event instance using solely its name, as name alone is not unique enough to be used as a primary key for looking up or playing events.

If your audio buddy is changing the event’s path, you may want to use its GUID instead - as long as the event itself is only being moved around and edited (i.e. not deleted and/or replaced with another event with the same name), then the GUID should not change. RuntimeManager.CreateInstance() accepts GUID as an argument alongside event path.

1 Like