Skip to content

Commit

Permalink
Merge branch 'main' into feat/clean-components
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunderscore authored Sep 24, 2023
2 parents d725df9 + 4f7182a commit fcdfa78
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Remove missing script components from the avatar at the start of the build.
- Suppress apply-on-play when Lyuma's Av3Emulator is active (improves compatibility) (#16)

### Changed

Expand Down
23 changes: 23 additions & 0 deletions Runtime/ApplyOnPlayGlobalActivator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#if UNITY_EDITOR

using System;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
Expand Down Expand Up @@ -51,6 +52,28 @@ private void Awake()
if (!RuntimeUtil.IsPlaying || this == null) return;

var scene = gameObject.scene;

// Check if Lyuma's Av3Emulator is present and enabled; if so, we leave preprocessing up to it.
// First, find the type...

Type ty_av3emu = null;
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
ty_av3emu = assembly.GetType("Lyuma.Av3Emulator.Runtime.LyumaAv3Emulator", false);
if (ty_av3emu != null) break;
}

if (ty_av3emu != null)
{
foreach (var root in scene.GetRootGameObjects())
{
if (root.GetComponentInChildren(ty_av3emu) != null)
{
return;
}
}
}

foreach (var root in scene.GetRootGameObjects())
{
foreach (var avatar in root.GetComponentsInChildren<VRCAvatarDescriptor>())
Expand Down

0 comments on commit fcdfa78

Please sign in to comment.