Skip to content

Commit

Permalink
Fixed calling EnableAudioLink before InitIDs
Browse files Browse the repository at this point in the history
• Made the global property IDs get initialized even if EnableAudioLink is called before OnEnable.
• Made the InitIDs function only initialize the IDs when called for the first time.
  • Loading branch information
Nestorboy committed Oct 30, 2023
1 parent 1fb8058 commit 6607bf4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Packages/com.llealloo.audiolink/Runtime/Scripts/AudioLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ private void InitIDs()
_Samples1R = PropertyToID("_Samples1R");
_Samples2R = PropertyToID("_Samples2R");
_Samples3R = PropertyToID("_Samples3R");

_IsInitialized = true;
}
#endregion

Expand Down Expand Up @@ -592,7 +594,6 @@ public void OnAsyncGpuReadbackComplete(AsyncGPUReadbackRequest request)

private void OnEnable()
{
InitIDs();
EnableAudioLink();
}

Expand Down Expand Up @@ -735,6 +736,7 @@ private void UpdateGlobalString(int nameID, string input)

public void EnableAudioLink()
{
InitIDs();
_audioLinkEnabled = true;
audioRenderTexture.updateMode = CustomRenderTextureUpdateMode.Realtime;
#if UDONSHARP
Expand Down

0 comments on commit 6607bf4

Please sign in to comment.