Specify event path in code

Hi,

In the latest version of fmod for unity it was possible to specify the path of an event directly in code :

[EventRef] private string myEvent = "path of my event";

With the latest version of the plugin, I had to replace all my [EventRef] by EventReference. But now I don’t know how to specify the path of my event and the only way for me to connect my event to my event Reference is to do it via the Unity Editor. If I try to this :

private EventReference myEvent = "path of my event";

I get the error :

Cannot implicitly convert type ‘string’ to ‘FMODUnity.EventReference’

This can be very inconvenient sometimes. For exemple if I want to specify my event from the UI, it will automatically modify the scene containing the game object the script is attached to in source control, which can be a problem if another develloper is working on the scene at the same time.

So what do I have to give to EventReference so it understand the event I want to attached to it ?

Is there still a way to get my event to connect to the reference without being dependant of the editor ?

Thanks for your response.

This is the proper way to assign default value to event paths

#if UNITY_EDITOR
void Reset()
{
eventReference = FMODUnity.EventReference.Find(“event:/music/music”);
}
#endif

From: https://fmod.com/docs/2.02/unity/api-common.html#eventreference