public static BaseLoaderDebugger Create(string type, string uniqueKey, BaseLoader loader) { if (IsApplicationQuit) { return(null); } //simplified uniqueKey uniqueKey = uniqueKey.Replace(AssetConfig.GetWritablePath(), "").Replace(AssetConfig.GetStreamingAssetsPath(), "").Replace(AssetConfig.GameAssetsFolder, ""); // create a BaseLoaderDebugger GameObject newHelpGameObject = new GameObject(uniqueKey); var newHelp = newHelpGameObject.AddComponent <BaseLoaderDebugger>(); newHelp.loader = loader; loader.DisposeEvent += () => { DebuggerObjectTool.RemoveFromParent(bigType, type, newHelpGameObject); }; // add to hierarchy DebuggerObjectTool.SetParent(bigType, type, newHelpGameObject); return(newHelp); }
// 可供调试删资源 private void OnDestroy() { if (!isRemoveFromParent) { DebuggerObjectTool.RemoveFromParent(bigType, type, gameObject); isRemoveFromParent = true; } }
private void Update() { if (theObject == null && !isRemoveFromParent) { DebuggerObjectTool.RemoveFromParent(bigType, type, gameObject); isRemoveFromParent = true; } }