# Using AttachInstanceToGameObject with given offset

**URL:** <https://qa.fmod.com/t/using-attachinstancetogameobject-with-given-offset/19133>\
**Category:** Unity\
**Tags:** unity, csharp\
**Created:** [August 15, 2022, 10:40am UTC](https://qa.fmod.com/t/using-attachinstancetogameobject-with-given-offset/19133 "2022-08-15T10:40:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ewoud](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/ewoud/32/3867_2.png) [@Ewoud](https://qa.fmod.com/u/Ewoud)\
**Post date:** [August 15, 2022, 10:40am UTC](https://qa.fmod.com/t/using-attachinstancetogameobject-with-given-offset/19133/1 "2022-08-15T10:40:48Z")

</div>

Hi, I would like to play audio on moving objects with a given offset, is this possible without creating extra gameobjects?

Here is an example that doesn’t work, but would better illustrate my point:  
Vector3 offset = new Vector3(0, 5, 1.5f);  
RuntimeManager.AttachInstanceToGameObject(instance, transform, offset);

---

<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:** [August 19, 2022, 5:10am UTC](https://qa.fmod.com/t/using-attachinstancetogameobject-with-given-offset/19133/2 "2022-08-19T05:10:17Z")

</div>

We do not have any existing overloads for that, I think it would be easiest to create a separate Transform or GameObject to attach the `EventInstance` to. I have passed this onto the Dev team for consideration in a future release, in the meantime, you could add it yourself like this:

```auto
public static void AttachInstanceToGameObjectWithOffset(FMOD.Studio.EventInstance instance, Transform transform, Vector3 offset)
{
    GameObject go = new GameObject();
    go.transform.position = transform.position + offset;
    go.transform.parent = transform;
    RuntimeManager.AttachInstanceToGameObject(instance, go.transform);
}

```

Thank you for the suggestion!
