Last active
August 6, 2021 14:54
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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