public void DisposeRuntimePrefabSystem() { for (int i = 0; i <= PackageRuntimePrefabInfoList.Count - 1; i++) { VegetationPackageRuntimePrefabInfo packageRuntimePrefabInfo = PackageRuntimePrefabInfoList[i]; for (int j = 0; j <= packageRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; j++) { VegetationItemRuntimePrefabInfo vegetationItemRuntimePrefabInfo = packageRuntimePrefabInfo.RuntimePrefabManagerList[j]; for (int k = 0; k <= vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; k++) { RuntimePrefabManager runtimePrefabManager = vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList[k]; runtimePrefabManager?.Dispose(); } } packageRuntimePrefabInfo.RuntimePrefabManagerList.Clear(); } PackageRuntimePrefabInfoList.Clear(); VisibleVegetationCellSelector?.Dispose(); VisibleVegetationCellSelector = null; DestroyRuntimePrefabParent(); }
public void DisposeColliderSystem() { if (JobHandleList.IsCreated) { JobHandleList.Dispose(); } for (int i = 0; i <= PackageColliderInfoList.Count - 1; i++) { VegetationPackageColliderInfo vegetationPackageColliderInfo = PackageColliderInfoList[i]; for (int j = 0; j <= vegetationPackageColliderInfo.ColliderManagerList.Count - 1; j++) { ColliderManager colliderManager = vegetationPackageColliderInfo.ColliderManagerList[j]; if (colliderManager != null) { colliderManager.OnCreateColliderDelegate -= OnCreateCollider; colliderManager.OnBeforeDestroyColliderDelegate -= OnBeforeDestroyCollider; } colliderManager?.Dispose(); } vegetationPackageColliderInfo.ColliderManagerList.Clear(); } PackageColliderInfoList.Clear(); VisibleVegetationCellSelector?.Dispose(); VisibleVegetationCellSelector = null; DestroyColliderParent(); }