diff --git a/Packages/nadena.dev.modular-avatar/Editor/AvatarProcessor.cs b/Packages/nadena.dev.modular-avatar/Editor/AvatarProcessor.cs index 6fd64cbe..51b3cb6f 100644 --- a/Packages/nadena.dev.modular-avatar/Editor/AvatarProcessor.cs +++ b/Packages/nadena.dev.modular-avatar/Editor/AvatarProcessor.cs @@ -24,6 +24,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; @@ -31,11 +32,11 @@ using System.Reflection; using System.Runtime.CompilerServices; using nadena.dev.modular_avatar.editor.ErrorReporting; using UnityEditor; -using UnityEditor.Build.Reporting; using UnityEngine; using VRC.SDK3.Avatars.Components; using VRC.SDKBase.Editor.BuildPipeline; using BuildReport = nadena.dev.modular_avatar.editor.ErrorReporting.BuildReport; +using Debug = UnityEngine.Debug; using Object = UnityEngine.Object; [assembly: InternalsVisibleTo("Tests")] @@ -158,6 +159,9 @@ namespace nadena.dev.modular_avatar.core.editor var vrcAvatarDescriptor = avatarGameObject.GetComponent(); + Stopwatch sw = new Stopwatch(); + sw.Start(); + using (BuildReport.CurrentReport.ReportingOnAvatar(vrcAvatarDescriptor)) { try @@ -283,6 +287,8 @@ namespace nadena.dev.modular_avatar.core.editor throw new Exception("Fatal error reported during avatar processing."); } } + + Debug.Log($"Processed avatar " + avatarGameObject.name + " in " + sw.ElapsedMilliseconds + "ms"); } private static void ClearEditorOnlyTagComponents(Transform obj) diff --git a/Packages/nadena.dev.modular-avatar/Editor/BuildContext.cs b/Packages/nadena.dev.modular-avatar/Editor/BuildContext.cs index 482087b2..fe2c2afa 100644 --- a/Packages/nadena.dev.modular-avatar/Editor/BuildContext.cs +++ b/Packages/nadena.dev.modular-avatar/Editor/BuildContext.cs @@ -14,7 +14,7 @@ namespace nadena.dev.modular_avatar.core.editor { internal readonly VRCAvatarDescriptor AvatarDescriptor; internal readonly AnimationDatabase AnimationDatabase = new AnimationDatabase(); - internal readonly AnimatorController AssetContainer; + internal readonly UnityEngine.Object AssetContainer; internal readonly Dictionary ClonedMenus = new Dictionary(); @@ -32,9 +32,10 @@ namespace nadena.dev.modular_avatar.core.editor AvatarDescriptor = avatarDescriptor; // AssetDatabase.CreateAsset is super slow - so only do it once, and add everything else as sub-assets. - // This animator controller exists for the sole purpose of providing a placeholder to dump everything we - // generate into. - AssetContainer = new AnimatorController(); + // This scriptable object exists for the sole purpose of providing a placeholder to dump everything we + // generate into. Note that we use a custom component here to force binary serialization; this saves both + // time as well as disk space (if you're using manual bake). + AssetContainer = ScriptableObject.CreateInstance(); AssetDatabase.CreateAsset(AssetContainer, Util.GenerateAssetPath()); } diff --git a/Packages/nadena.dev.modular-avatar/Runtime/MAAssetBundle.cs b/Packages/nadena.dev.modular-avatar/Runtime/MAAssetBundle.cs new file mode 100644 index 00000000..bec03ef7 --- /dev/null +++ b/Packages/nadena.dev.modular-avatar/Runtime/MAAssetBundle.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace nadena.dev.modular_avatar.core +{ + [PreferBinarySerialization] + class MAAssetBundle : ScriptableObject + { + } +} \ No newline at end of file diff --git a/Packages/nadena.dev.modular-avatar/Runtime/MAAssetBundle.cs.meta b/Packages/nadena.dev.modular-avatar/Runtime/MAAssetBundle.cs.meta new file mode 100644 index 00000000..fd3b8658 --- /dev/null +++ b/Packages/nadena.dev.modular-avatar/Runtime/MAAssetBundle.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0e82ebb24aca47b7bc95ca94668015a6 +timeCreated: 1690643821 \ No newline at end of file