# Reference Sound Event by GUID

**URL:** <https://qa.fmod.com/t/reference-sound-event-by-guid/15271>\
**Category:** Unity\
**Created:** [December 3, 2019, 1:38pm UTC](https://qa.fmod.com/t/reference-sound-event-by-guid/15271 "2019-12-03T13:38:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gianni](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/gianni/32/840_2.png) [@Gianni](https://qa.fmod.com/u/Gianni)\
**Post date:** [December 3, 2019, 1:38pm UTC](https://qa.fmod.com/t/reference-sound-event-by-guid/15271/1 "2019-12-03T13:38:49Z")

</div>

How can I reference a Soundevent in a script by GUID?  
in Unity scripts I usually create a public string, so I can use the [FMODUnity.EventRef] attribute to browse for events in the gameobject inspector.  
Is it possible to keep the browse feature but storing a GUID reference to SoundEvent instead ?  
Thanks

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [December 5, 2019, 12:56am UTC](https://qa.fmod.com/t/reference-sound-event-by-guid/15271/2 "2019-12-05T00:56:00Z")

</div>

Yes, you can reference events by their GUID. You can use the public string for the path and pass that into the `PathToGUID` function to get the GUID of that event.

[https://www.fmod.com/resources/documentation-unity?version=2.0&page=api-runtimemanager.html#pathtoguid](https://www.fmod.com/resources/documentation-unity?version=2.0&page=api-runtimemanager.html#pathtoguid)

---

<div class="post-metadata">

**Author:** ![Gianni](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/gianni/32/840_2.png) [@Gianni](https://qa.fmod.com/u/Gianni)\
**Post date:** [December 5, 2019, 7:39am UTC](https://qa.fmod.com/t/reference-sound-event-by-guid/15271/3 "2019-12-05T07:39:38Z")

</div>

Thanks Richard but this won’t solve the problem of storing the string into the inspector.  
I’d like to avoid the use of string references stored in unity pub var, so I can rename events and they still works. I’m searching for a solution that allow me to browse for the event with the browser but stores the GUID (not the string) into the Unity public variable. I’ve read that FMOD 2 allow a direct GUID reference, but what about the inspector? Is that possible?  
I think a specific attribute for GUID type var could solve the problem in an elegant way

Thanks!

**Gianni Ricciardi**

_CEO & Music Producer_

---

<div class="post-metadata">

**Author:** ![alexzzen](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alexzzen/32/6825_2.png) [@alexzzen](https://qa.fmod.com/u/alexzzen)\
**Post date:** [December 5, 2019, 10:42am UTC](https://qa.fmod.com/t/reference-sound-event-by-guid/15271/4 "2019-12-05T10:42:24Z")

</div>

You can do something like this:

```
[FMODUnity.EventRef] [SerializeField]
private string fmodEvent;

public System.Guid FmodEvent
{
    get { return FMODUnity.RuntimeManager.PathToGUID(this.fmodEvent); }
}

```

you are still able to select the event in the inspector and then you can use the `FmodEvent` property to do stuff with the event GUID. You will need to create a property for each event though.
