using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; using System.Linq; using System.IO; public class AnimatorCullMode : ResourceScanBase { [MenuItem("ResourceTool/Animator Cull Mode to Completely")] public static void StartSetCullMode() { var instance = new AnimatorCullMode(); instance.Start(); } private AnimatorCullMode() : base(".prefab") { } protected override void FixOneAsset(GameObject asset, string assetPath) { var animator = asset.GetComponentInChildren(); if (animator != null) { var instance = Object.Instantiate(asset); try { var anims = instance.GetComponentsInChildren(); for (var i = 0; i < anims.Length; i++) anims[i].cullingMode = AnimatorCullingMode.CullCompletely; PrefabUtility.CreatePrefab(AssetDatabase.GetAssetPath(asset), instance, ReplacePrefabOptions.ReplaceNameBased); } catch (System.Exception e) { Debug.LogError(e.ToString()); } Object.DestroyImmediate(instance); } } }