Cant use [EventRef] or [EventReference] in unity

Hi
I’m a bit new to scripting for this specific API.
There is a very simple script I took from scott games (i’m learning) and he uses [EventRef] that is obsolete on fmod 2.02. I’ve switched the [EventRef] to [EventReference] and unity still doesn’t want to compile. Switching from GUID to Path doesn’t work.

Hi,

What version of Unity and FMOD are you using? Could I also grab a link to the tutorial you are using? Finally, could I get a code snippet that is failing to compile?

We provide an example script for some basic API functions in the Unity Integration | Scripting Examples section, which uses public FMODUnity.EventReference.

Hope this helps!

I used the [EventRef] before but now it works with the “public FMODUnity.EventReference …”

1 Like

Hey,
I’m also new to FMOD and learning with the Scott Games Courses! I also couldn’t get the music to play on start. I ended up finding that just by deleting the line [FMODUnity.EventRef] that it worked. Don’t know if that’s the proper way but it’s worked for now!

1 Like

Hi,

Thank you for sharing the solution.

Correct, deleting [FMODUnity.EventRef] is fine as it is deprecated and will need to be removed.

EventReference.Path is only for UnityEditor, use EventReference.ToString() instead