I am using FMODUnity.RuntimeManager.StudioSystem.getEvent(path, out eventDescription) to check if an event with a specific path exists and then create it with FMODUnity.RuntimeManager.CreateInstance(string path). The event can’t be found, and an instance cannot be created.
When referencing through EventReference instead of a path string, it works as it contains GUID, if I understand it correctly.
I found out that this stopped working after upgrade from 2.02.19 to 2.02.20
I have this use case - animation starts playing, I want to look if there is an event with an appropriate name and if so, start it. So I don’t have any serialized EventReference, only a dynamic path string.
My question is - is this a bug or intended behavior? Should there be this method overload when passing a path string does not work? And if this is intended behavior, how do you suggest creating events with dynamic paths? Any tips for caching GUIDs?
Unfortunately, I haven’t been able to reproduce the issue you’re describing - I’m able to use StudioSystem.getEvent() to retrieve EventDescriptions by path, and also create the events by path with RuntimeManager.CreateInstance(), without any problems on 2.02.20.
I’d recommend checking the FMOD_RESULT that Studio.getEvent() is returning, which should help point you in the right direction. It’s also worth noting that in order for path-based lookups to succeed, your project’s strings bank must be loaded, which would be the go-to culprit for what you’re running into.
Hi, thank you very much for the answer! It really was by strings bank not loaded. Strange that it worked in earlier version without it. Thanks!
Anyway, might be nice to add this note to the documentation that strings bank have to be loaded in order for paths to work. As it is strange when the same method is not working when passing EventReference and not a string path.
This information is present in the Studio API reference, but isn’t in the Unity API reference, so I’ll flag the Unity docs for a fix - thanks for pointing that out.
Could I get you to elaborate on what you mean by this? A simple set of steps or a code snippet that reproduce the issue consistently would help me to identify what exactly the issue is.
I am just thinking about the situation I experienced. I was searching hard but cannot find anything why FMODUnity.RuntimeManager.CreateInstance(string path) is not working while FMODUnity.RuntimeManager.CreateInstance(EventReference eventReference) for the same event is not.
Now I understand it, but to get to that info was a bit of pain and believe me I searched a lot That is also what I found confusing (though I understand it now and don’t have any obvious solution) that these methods behaves differently without any warning when passing different types of arguments for the same event.