Răsfoiți Sursa

修复BundleDownloadrComponent使用完后没有从Game.Scene中移除的bug (#149)

ks 6 ani în urmă
părinte
comite
8dee8b8207

+ 24 - 0
Unity/Assets/Model/Module/AssetsBundle/BundleDownloaderComponent.cs

@@ -32,6 +32,30 @@ namespace ETModel
 		public string downloadingBundle;
 
 		public UnityWebRequestAsync webRequest;
+		
+		public override void Dispose()
+		{
+				if (this.IsDisposed)
+				{
+						return;
+				}
+
+				if (this.Entity.IsDisposed)
+				{
+						return;
+				}
+
+				base.Dispose();
+
+				this.remoteVersionConfig = null;
+				this.TotalSize = 0;
+				this.bundles = null;
+				this.downloadedBundles = null;
+				this.downloadingBundle = null;
+				this.webRequest?.Dispose();
+
+				this.Entity.RemoveComponent<BundleDownloaderComponent>();
+		}
 
 		public async ETTask StartAsync()
 		{