# Cannot convert from 'FMODUnity.EventReference' to 'string'

**URL:** <https://qa.fmod.com/t/cannot-convert-from-fmodunity-eventreference-to-string/18563>\
**Category:** Unity\
**Tags:** unity\
**Created:** [March 22, 2022, 4:11pm UTC](https://qa.fmod.com/t/cannot-convert-from-fmodunity-eventreference-to-string/18563 "2022-03-22T16:11:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![g.hadji](https://avatars.discourse-cdn.com/v4/letter/g/b19c9b/32.png) [@g.hadji](https://qa.fmod.com/u/g.hadji)\
**Post date:** [March 22, 2022, 4:11pm UTC](https://qa.fmod.com/t/cannot-convert-from-fmodunity-eventreference-to-string/18563/1 "2022-03-22T16:11:06Z")

</div>

Hi. I’ve been upgrading to the **2.02.04** version of the integration plugin. All my event references were set up this way :

```auto
[SerializeField][EventRef] private string eventName;

```

After upgrading the plugin I had the following message under my events in the inspector :

> **[EventRef]** is obsolete - use the **EventReference** type instead

which I did. For most of my events everything works fine but I had this issue lately and I don’t know what to do in order to make it work :

I have several events that are called by a **PlayOneShotAttached()** function. Here is my how it is called basically :

```auto
[SerializeField] EventReference eventName;

```

```auto
private void Update()
{
  if(aConditionIsMet)
    RuntimeManager.PlayOneShotAttached(eventName, targetObject);
}

```

After saving, I had the following error in my log :

> error CS1503: Argument 1: cannot convert from ‘FMODUnity.EventReference’ to ‘string’

Should I be able to use **PlayOneShotAttached()** or did I miss something new that doesn’t require a string ?

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [March 23, 2022, 5:28am UTC](https://qa.fmod.com/t/cannot-convert-from-fmodunity-eventreference-to-string/18563/2 "2022-03-23T05:28:58Z")

</div>

Try calling `PlayOneShotAttached` with the event reference’s guid:

```auto
RuntimeManager.PlayOneShotAttached(eventName.Guid, targetObject);

```

That does make updating to 2.02.xx needlessly complicated, I will pass this onto the dev team and see if we can get an overload of `PlayOneShotAttached` for the `EventReference` type or something similar.

---

<div class="post-metadata">

**Author:** ![g.hadji](https://avatars.discourse-cdn.com/v4/letter/g/b19c9b/32.png) [@g.hadji](https://qa.fmod.com/u/g.hadji)\
**Post date:** [March 23, 2022, 9:14am UTC](https://qa.fmod.com/t/cannot-convert-from-fmodunity-eventreference-to-string/18563/3 "2022-03-23T09:14:04Z")

</div>

Hi Jeff. Thanks for your answer ! Once you told me, I didn’t find this that complicated, but it could definitely being added to the documentation. Unless I missed it (or searched in the wrong place) I did not see any mention of this change : [https://www.fmod.com/resources/documentation-api?version=2.02&page=welcome-whats-new-202.html#api-differences\_1](https://www.fmod.com/resources/documentation-api?version=2.02&page=welcome-whats-new-202.html#api-differences_1)

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [March 23, 2022, 10:07pm UTC](https://qa.fmod.com/t/cannot-convert-from-fmodunity-eventreference-to-string/18563/4 "2022-03-23T22:07:44Z")

</div>

This is definitely just something that was missed when we moved over to EventReferences- it looks like `PlayOneShot` got an EventReference overload but `PlayOneShotAttached` did not, so we’ll be adding one in a future release. Thank you for bringing this to our attention!
