public void LateUpdate() { if (m_NeedUnloadList.Count == 0) { return; } int lastIndex = m_NeedUnloadList.Count - 1; AResource resource = m_NeedUnloadList[lastIndex]; if (now < resource.destroyTime) { return; } m_ResourceDic.Remove(resource.url); m_NeedUnloadList.RemoveAt(lastIndex); //依赖引用-1 if (resource.dependencies != null) { for (int i = 0; i < resource.dependencies.Length; i++) { AResource temp = resource.dependencies[i]; Unload(temp); } } resource.UnLoad(); }
public void LateUpdate() { if (m_NeedUnloadList.Count == 0) { return; } while (m_NeedUnloadList.Count > 0) { AResource resource = m_NeedUnloadList.First.Value; m_NeedUnloadList.RemoveFirst(); if (resource == null) { continue; } m_ResourceDic.Remove(resource.url); resource.UnLoad(); //依赖引用-1 if (resource.dependencies != null) { for (int i = 0; i < resource.dependencies.Length; i++) { AResource temp = resource.dependencies[i]; Unload(temp); } } } }