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);
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:
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);
}