# Cant use \[EventRef\] or \[EventReference\] in unity

**URL:** <https://qa.fmod.com/t/cant-use-eventref-or-eventreference-in-unity/19955>\
**Category:** Unity\
**Tags:** unity\
**Created:** [March 9, 2023, 5:57pm UTC](https://qa.fmod.com/t/cant-use-eventref-or-eventreference-in-unity/19955 "2023-03-09T17:57:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cocofou](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Cocofou](https://qa.fmod.com/u/Cocofou)\
**Post date:** [March 9, 2023, 5:57pm UTC](https://qa.fmod.com/t/cant-use-eventref-or-eventreference-in-unity/19955/1 "2023-03-09T17:57:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [March 9, 2023, 11:41pm UTC](https://qa.fmod.com/t/cant-use-eventref-or-eventreference-in-unity/19955/2 "2023-03-09T23:41:54Z")

</div>

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](https://fmod.com/docs/2.02/unity/examples-basic.html) section, which uses `public FMODUnity.EventReference`.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![Cocofou](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Cocofou](https://qa.fmod.com/u/Cocofou)\
**Post date:** [March 10, 2023, 7:48am UTC](https://qa.fmod.com/t/cant-use-eventref-or-eventreference-in-unity/19955/3 "2023-03-10T07:48:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dhiles25](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@dhiles25](https://qa.fmod.com/u/dhiles25)\
**Post date:** [February 8, 2024, 6:25am UTC](https://qa.fmod.com/t/cant-use-eventref-or-eventreference-in-unity/19955/4 "2024-02-08T06:25:12Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [February 9, 2024, 2:00am UTC](https://qa.fmod.com/t/cant-use-eventref-or-eventreference-in-unity/19955/5 "2024-02-09T02:00:16Z")

</div>

Hi,

Thank you for sharing the solution.

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

---

<div class="post-metadata">

**Author:** ![ManjaDev](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@ManjaDev](https://qa.fmod.com/u/ManjaDev)\
**Post date:** [November 7, 2024, 11:00pm UTC](https://qa.fmod.com/t/cant-use-eventref-or-eventreference-in-unity/19955/6 "2024-11-07T23:00:35Z")

</div>

> [@Cocofou](#):
>
> public

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