Skip to content

Commit

Permalink
initiliaze globals properly
Browse files Browse the repository at this point in the history
  • Loading branch information
z3y committed Oct 23, 2023
1 parent df90963 commit 662e713
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Runtime/CBIRPLight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async void CopyShadowMaskID()
{
await Task.Delay(1000);

if (Application.isPlaying)
if (Application.isPlaying || !_unityLight)
{
return;
}
Expand Down
1 change: 0 additions & 1 deletion Runtime/CBIRPManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#if UNITY_EDITOR && !COMPILER_UDONSHARP
using UnityEditor;
using System.Threading.Tasks;
#endif

namespace CBIRP
Expand Down
16 changes: 16 additions & 0 deletions Runtime/CBIRPManagerEditor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#if !COMPILER_UDONSHARP && UNITY_EDITOR
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
Expand All @@ -14,6 +15,21 @@ public class CBIRPManagerEditor : IProcessSceneWithReport, IActiveBuildTargetCha
{
public int callbackOrder => 0;

[InitializeOnLoadMethod]
public async static void InitliazeGlobals()
{
await Task.Delay(1000);

var manager = GameObject.FindObjectOfType<CBIRPManager>();
if (!manager)
{
return;
}

manager.OnValidate();
}


public void OnActiveBuildTargetChanged(BuildTarget previousTarget, BuildTarget newTarget)
{
// clear out packed texture arrays to not destroy performance on android
Expand Down

0 comments on commit 662e713

Please sign in to comment.