using System.Collections.Generic; using System.IO; using System.Text; using UnityEngine; public class BundleDebugManager : MonoBehaviour { private readonly List bundles = new List(); private readonly HashSet ignoreBundles = new HashSet(); private int _index; private static BundleDebugManager _instance; private void Awake() { _instance = this; DontDestroyOnLoad(gameObject); } private void OnGUI() { if (GUILayout.Button("Record Bundles")) { var builder = new StringBuilder(); foreach (var bundle in bundles) { builder.AppendLine(bundle); ignoreBundles.Add(bundle); } bundles.Clear(); File.WriteAllText(Application.dataPath.MoveUp().Open(string.Format("Record_{0}.txt", _index)), builder.ToString()); _index++; } } public static void AppendBundle(string bundle) { if (_instance && !_instance.bundles.Contains(bundle) && !_instance.ignoreBundles.Contains(bundle)) _instance.bundles.Add(bundle); } }