Skip to content

Instantly share code, notes, and snippets.

@made-indrayana
Last active August 6, 2021 14:54
Show Gist options
  • Save made-indrayana/098dcc357d13a84894b24481626fdffa to your computer and use it in GitHub Desktop.
Save made-indrayana/098dcc357d13a84894b24481626fdffa to your computer and use it in GitHub Desktop.
Location fix by forcing an AudioSource to continually stop and play to force localization update on Google Resonance
// Google Resonance Audio Location Bug Fix
// Author: Made Indrayana
// MIT License
// Location fix by forcing an AudioSource to continually stop and play to force localization update on Google Resonance
// Use a 100ms empty WAV
public class ResonanceLocationBugFix : MonoBehaviour
{
[SerializeField]
private AudioSource audioSource;
void Start()
{
InvokeRepeating("EmptyLoop", 0.1f, 0.1f);
}
void EmptyLoop()
{
audioSource.Stop();
audioSource.Play();
//Other way to trigger is:
//audioSource.enabled = false;
//audioSource.enabled = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment