Ejemplo n.º 1
0
 public void UnloadAsset(string componentName, bool ignoreUnloadUnusedAssets = false)
 {
     if (_globalComponentTable.ContainsKey(componentName))
     {
         Fabric.Component component = _globalComponentTable[componentName];
         if (component != null)
         {
             _components.Remove(component);
             if (component.ParentComponent != null)
             {
                 component.ParentComponent.RemoveComponent(component);
             }
             RemoveChildComponentsFromGlobalTable(component, componentName);
             component.Destroy();
             UnityEngine.Object.Destroy(component.gameObject);
             if (!ignoreUnloadUnusedAssets)
             {
                 Resources.UnloadUnusedAssets();
             }
             DebugLog.Print("Assets [" + componentName + "] unloaded succesfuly");
         }
         else
         {
             DebugLog.Print("Assets [" + componentName + "] failed to unload", DebugLevel.Error);
         }
     }
     else
     {
         DebugLog.Print("Target Component [" + componentName + "] not found", DebugLevel.Error);
     }
 }