mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-04 13:45:04 +08:00
f077d24d48
This new implementation avoids creating any internal objects within the avatar itself, instead creating them as hidden scene root objects. We also move all update processing to be driven by camera callbacks as well. These changes help improve compatibility with tools such as FaceEmo, as well as being less likely to break when other tools manipulate the avatar's hierarchy directly.
41 lines
936 B
C#
41 lines
936 B
C#
#region
|
|
|
|
using System;
|
|
using HarmonyLib;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
#endregion
|
|
|
|
namespace nadena.dev.modular_avatar.core.editor.HarmonyPatches
|
|
{
|
|
internal class PatchLoader
|
|
{
|
|
private static readonly Action<Harmony>[] patches = new Action<Harmony>[]
|
|
{
|
|
HierarchyViewPatches.Patch,
|
|
#if UNITY_2022_3_OR_NEWER
|
|
HandleUtilityPatches.Patch_FilterInstanceIDs,
|
|
PickingObjectPatch.Patch,
|
|
#endif
|
|
};
|
|
|
|
[InitializeOnLoadMethod]
|
|
static void ApplyPatches()
|
|
{
|
|
var harmony = new Harmony("nadena.dev.modular_avatar");
|
|
|
|
foreach (var patch in patches)
|
|
{
|
|
try
|
|
{
|
|
patch(harmony);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Debug.LogException(e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |