protected override void OnDrawScrollableWindow() { GUILayout.Label("<b>Operation Settings</b>"); GUILayout.BeginVertical("box"); { ObjectPoolComponent objectPoolComponent = GameEntry.GetComponent <ObjectPoolComponent>(); if (objectPoolComponent != null) { if (GUILayout.Button("Object Pool Release", GUILayout.Height(30f))) { objectPoolComponent.Release(); } if (GUILayout.Button("Object Pool Release All Unused", GUILayout.Height(30f))) { objectPoolComponent.ReleaseAllUnused(); } } ResourceComponent resourceCompoent = GameEntry.GetComponent <ResourceComponent>(); if (resourceCompoent != null) { if (GUILayout.Button("Unload Unused Assets", GUILayout.Height(30f))) { resourceCompoent.UnloadUnusedAssets(false, "release from debugger"); } if (GUILayout.Button("Unload Unused Assets and Garbage Collect", GUILayout.Height(30f))) { resourceCompoent.UnloadUnusedAssets(true, "release from debugger"); } } if (GUILayout.Button("Restart Game Framework", GUILayout.Height(30f))) { GameEntry.Restart(); } if (GUILayout.Button("Shutdown Game Framework", GUILayout.Height(30f))) { GameEntry.Shutdown(); } } GUILayout.EndVertical(); }
/// <summary> /// 卸载场景。 /// </summary> /// <param name="sceneName">场景名称。</param> /// <returns>是否成功卸载场景。</returns> public override bool UnloadScene(string sceneName) { bool retVal = SceneManager.UnloadScene(sceneName); if (retVal) { m_ResourceComponent.UnloadUnusedAssets(false, "release scene"); } return(retVal); }
static int UnloadUnusedAssets(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityGameFramework.Runtime.ResourceComponent obj = (UnityGameFramework.Runtime.ResourceComponent)ToLua.CheckObject(L, 1, typeof(UnityGameFramework.Runtime.ResourceComponent)); bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.UnloadUnusedAssets(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 释放声音资源。 /// </summary> /// <param name="soundAsset">要释放的声音资源。</param> public override void ReleaseSoundAsset(object soundAsset) { m_ResourceComponent.UnloadUnusedAssets(false, "release sound asset"); }
/// <summary> /// 释放实体资源。 /// </summary> /// <param name="entityAsset">要释放的实体资源。</param> public override void ReleaseEntityAsset(object entityAsset) { m_ResourceComponent.UnloadUnusedAssets(false); }
/// <summary> /// 释放字典资源。 /// </summary> /// <param name="dictionaryAsset">要释放的字典资源。</param> public override void ReleaseDictionaryAsset(object dictionaryAsset) { m_ResourceComponent.UnloadUnusedAssets(false, "release dictionary asset"); }
/// <summary> /// 释放数据表资源。 /// </summary> /// <param name="dataTableAsset">要释放的数据表资源。</param> public override void ReleaseDataTableAsset(object dataTableAsset) { m_ResourceComponent.UnloadUnusedAssets(false); }
/// <summary> /// 释放界面实例。 /// </summary> /// <param name="uiFormInstance">要释放的界面实例。</param> public override void ReleaseUIFormInstance(object uiFormInstance) { DestroyObject(uiFormInstance as GameObject); m_ResourceComponent.UnloadUnusedAssets(false); }