/// <summary> /// Questの制限値に関するエラーメッセージを取得します。 /// </summary> /// <param name="prefab"></param> /// <returns></returns> private static IEnumerable <Converter.Message> GenerateQuestLimitationsErrorMessages(GameObject prefab) { var messages = new List <Converter.Message>(); AvatarPerformanceStats statistics = new AvatarPerformanceStats(); AvatarPerformance.CalculatePerformanceStats("", prefab, statistics); AvatarPerformanceStatsLevel performanceStatLimits = VRChatUtility.AvatarPerformanceStatsLevelSets["Quest"].medium; foreach (var limitation in new[] { new { current = statistics.skinnedMeshCount, limit = performanceStatLimits.skinnedMeshCount, message = _("The number of Skinned Mesh Renderer components is {0}.") }, new { current = statistics.meshCount, limit = performanceStatLimits.meshCount, message = _("The number of (non-Skinned) Mesh Renderer components is {0}.") }, new { current = statistics.materialCount, limit = performanceStatLimits.materialCount, message = _("The number of material slots (sub-meshes) is {0}.") }, new { current = statistics.boneCount, limit = performanceStatLimits.boneCount, message = _("The number of Bones is {0}.") }, }) { if (limitation.current > limitation.limit) { messages.Add(new Converter.Message { message = string.Format(limitation.message, limitation.current) + string.Format( _("If this value exceeds {0}, the avatar will not shown under the default user setting."), limitation.limit ), type = MessageType.Error, }); } } return(messages); }
/// <summary> /// DynamicBoneの制限の既定値を超えていた場合、警告メッセージを返します。 /// </summary> /// <seealso cref="AvatarPerformance.AnalyzeDynamicBone"/> /// <param name="prefabInstance"></param> /// <returns></returns> private static IEnumerable <Converter.Message> GetMessagesAboutDynamicBoneLimits(GameObject avatar) { var messages = new List <Converter.Message>(); #if VRC_SDK_VRCSDK2 || VRC_SDK_VRCSDK3 AvatarPerformanceStats statistics = new AvatarPerformanceStats(); AvatarPerformance.CalculatePerformanceStats(avatar.GetComponent <VRMMeta>().Meta.Title, avatar, statistics); AvatarPerformanceStatsLevel mediumPerformanceStatLimits = VRChatUtility.AvatarPerformanceStatsLevelSets["PC"].medium; if (statistics.dynamicBoneSimulatedBoneCount > mediumPerformanceStatLimits.dynamicBoneSimulatedBoneCount) { messages.Add(new Converter.Message { message = string.Format( _("The “Dynamic Bone Simulated Bone Count” is {0}."), statistics.dynamicBoneSimulatedBoneCount ) + string.Format( _("If this value exceeds {0}, the default user setting disable all Dynamic Bones."), mediumPerformanceStatLimits.dynamicBoneSimulatedBoneCount ), type = MessageType.Warning, }); } if (statistics.dynamicBoneCollisionCheckCount > mediumPerformanceStatLimits.dynamicBoneCollisionCheckCount) { messages.Add(new Converter.Message { message = string.Format( _("The “Dynamic Bone Collision Check Count” is {0}."), statistics.dynamicBoneCollisionCheckCount ) + string.Format( _("If this value exceeds {0}, the default user setting disable all Dynamic Bones."), mediumPerformanceStatLimits.dynamicBoneCollisionCheckCount ), type = MessageType.Warning, }); } #endif return(messages); }