两个列表进骑行释放内存

This commit is contained in:
Caiyanpeng committed 2021-11-16 18:41:18 +08:00
1 parent 3295314b7e
commit 6a4390f1b9
7 files changed
+88 -32

No files matched your search

@@ -262,6 +262,7 @@ public class MapListController : PFUIPanel
});
//sortDir.GetComponent<Button>().onClick.AddListener();
}
caches = new Dictionary<string, Texture>();
}
void onEndEdit()
{
@@ -354,6 +355,7 @@ public class MapListController : PFUIPanel
}
}
Dictionary<string, Texture> caches = null;
void DisplayMaps(List<MapRoute> list)
{
if (map != null)
@@ -361,7 +363,7 @@ public class MapListController : PFUIPanel
foreach (var item in list)
{
var obj = Instantiate(map);
obj.GetComponent<MapItem>().Initial(item);
obj.GetComponent<MapItem>().Initial(item, caches);
//obj.SendMessage("Initial", );
obj.transform.SetParent(content.transform);
obj.transform.localScale = new Vector3(1, 1, 1);
@@ -468,4 +470,12 @@ public class MapListController : PFUIPanel
ResetPanel();
transform.MyDOFade();
}
protected override void OnDestroy()
{
caches = null;
Resources.UnloadUnusedAssets();
GC.Collect();
Debug.Log("list empty");
}
}