From a32ece3545c8b9588c5d443323f956872f3cd92f Mon Sep 17 00:00:00 2001 From: godzzz Date: Sat, 16 Dec 2023 18:35:55 +0400 Subject: [PATCH] [0.2.4] Base dependency updated; Cleaning --- Docs/README.RU.md | 12 +++--- Docs/README.md | 12 +++--- Editor/Drawers/ResourcesReferenceDrawer.cs | 2 +- Plugins/Depra.Assets.dll | Bin 17920 -> 17920 bytes Plugins/Depra.Assets.dll.meta | 45 +-------------------- Runtime/Files.Resource/ResourcesPath.cs | 25 +++++------- package.json | 2 +- 7 files changed, 27 insertions(+), 71 deletions(-) diff --git a/Docs/README.RU.md b/Docs/README.RU.md index 3769667..ac6fe84 100644 --- a/Docs/README.RU.md +++ b/Docs/README.RU.md @@ -114,7 +114,8 @@ resourceTexture.Unload(); #### Загрузка AssetBundle ```csharp -var assetBundleFile = new AssetBundleFile("Path/To/MyBundle"); +var assetBundleSource = new AssetBundleFromFile(); +var assetBundleFile = new AssetBundleFile("Path/To/MyBundle", assetBundleSource); AssetBundle loadedBundle = assetBundleFile.Load(); // Использование загруженного ассета. assetBundleFile.Unload(); @@ -127,7 +128,7 @@ var assetBundle = AssetBundle.LoadFromFile("Path/To/MyBundle"); var assetBundleAsset = new AssetBundleAssetFile("MyAsset", assetBundle); GameObject loadedAsset = assetBundleAsset.Load(); // Использование загруженного ассета. -assetBundleAsset.Dispose(); +assetBundleAsset.Unload(); ``` #### Загрузка ассета из редакторской базы данных @@ -136,16 +137,17 @@ assetBundleAsset.Dispose(); var databaseAsset = new DatabaseAsset("Path/To/MyAsset"); MyScriptableObject loadedObject = databaseAsset.Load(); // Использование загруженного ассета. -databaseAsset.Dispose(); +databaseAsset.Unload(); ``` #### Загрузка ассета из настроек проекта ```csharp -var preloadedAsset = new PreloadedAsset("Path/To/MyAsset"); +var anyAsset = new ResourcesAsset("Path/To/MyAsset"); +var preloadedAsset = new PreloadedAsset(anyAsset); GameObject loadedAsset = preloadedAsset.Load(); // Использование загруженного ассета. -preloadedAsset.Dispose(); +preloadedAsset.Unload(); ``` ## 🖇️ Зависимости diff --git a/Docs/README.md b/Docs/README.md index e3c3310..331a354 100644 --- a/Docs/README.md +++ b/Docs/README.md @@ -114,7 +114,8 @@ resourceTexture.Unload(); #### Loading an AssetBundle ```csharp -var assetBundleFile = new AssetBundleFile("Path/To/MyBundle"); +var assetBundleSource = new AssetBundleFromFile(); +var assetBundleFile = new AssetBundleFile("Path/To/MyBundle", assetBundleSource); AssetBundle loadedBundle = assetBundleFile.Load(); // Use the loaded asset. assetBundleFile.Unload(); @@ -127,7 +128,7 @@ var assetBundle = AssetBundle.LoadFromFile("Path/To/MyBundle"); var assetBundleAsset = new AssetBundleAssetFile("MyAsset", assetBundle); GameObject loadedAsset = assetBundleAsset.Load(); // Use the loaded asset. -assetBundleAsset.Dispose(); +assetBundleAsset.Unload(); ``` #### Loading an Asset from the Editor Database @@ -136,16 +137,17 @@ assetBundleAsset.Dispose(); var databaseAsset = new DatabaseAsset("Path/To/MyAsset"); MyScriptableObject loadedObject = databaseAsset.Load(); // Use the loaded asset. -databaseAsset.Dispose(); +databaseAsset.Unload(); ``` #### Loading an Asset from Project Settings ```csharp -var preloadedAsset = new PreloadedAsset("Path/To/MyAsset"); +var anyAsset = new ResourcesAsset("Path/To/MyAsset"); +var preloadedAsset = new PreloadedAsset(anyAsset); GameObject loadedAsset = preloadedAsset.Load(); // Use the loaded asset. -preloadedAsset.Dispose(); +preloadedAsset.Unload(); ``` ## 🖇 Dependencies diff --git a/Editor/Drawers/ResourcesReferenceDrawer.cs b/Editor/Drawers/ResourcesReferenceDrawer.cs index fab1fdf..0c2c901 100644 --- a/Editor/Drawers/ResourcesReferenceDrawer.cs +++ b/Editor/Drawers/ResourcesReferenceDrawer.cs @@ -47,7 +47,7 @@ private void ApplyPropertyChange(Object objectAsset) if (objectAsset != null) { var projectPath = AssetDatabase.GetAssetPath(objectAsset); - if (Resources.Load(ResourcesPath.Utility.FindRelativePath(projectPath)) != null) + if (Resources.Load(ResourcesPath.FindRelativePath(projectPath)) != null) { assetProjectPath = projectPath; } diff --git a/Plugins/Depra.Assets.dll b/Plugins/Depra.Assets.dll index 212a14a6efdf902d76b9c7563411facce34085a1..5542da34f8f627c007b51d61ef8b67d87ecfd38f 100644 GIT binary patch delta 3084 zcmY+G3v3kE6^8#ikDYzY`fam*vi7d+^)u#S2(UKm;s_RELh9g%N0EsG2r#(KrV0%W zyg0x4!1SCph$LsYd@g-RExgfxv)A|ncEB8UT3+Q=3(N>!TDBqFq;PR~6%BFRYm z&-uLD7Fu9DYvgOf+5|IanfYkNo0MF=h)ULDYgBMwK3?2Fo5QD)C* z^TN{CR}OfqX4N(-Y9vTpFe7Ta6tyu^srM*qU&vmoM@7g!qAy)kDNA;7DK8Y2OFtv) zqqa&-cX+tAu>$B{ny8Vv(gqSWw$~LCwe~7kt+z?~EAn?FnrzEui#c|#5fROH)Ho%Y z?2ipwEVKvRSH$vEmnSGh+nY5eTI~UBwFMld#>-e zSYc24=8EOE+pHI>?PhbI=&(4)c;3hZoHlqXLOdraq=ZbTfUxRDvx`4Lq(4+u)Z2 zZ!=b6M`|E%i(-ws_xLmQEWFNtjA8dKZ69?!&ou3sG$g(4&?dK}YfKZEVG7ed00wZt zd|%7P15BgtFZ}s>4jy*sQ=&XW;0lI^$Z6?n2r zCV%MpjdEUu@qMQB4GrUYCl*orlrYXZu`3?y5~aSGMr`swrH2uu$B)X0fI6U8;*LW% zl^+m27)i%URe@^!%AxtbX{8#kFinemUkkbi)wto%JLt6t)5nBg z&h1N*tGGvcx}lS)2h^@FGxeLwEUg;<=A!aiWT6H=dcgo`szv2JdP%QC>>j3@c+sH>^A&v#_fxsd0x{pA36ZV6tuMGorZ%b5D~}Ep6GG9Z^~HFNTZ{x& z_@2cQT)5Xz5M5>(q9-{bmRR`5S5l++{41$ZpjMV0!YaCKQJ4-rPd6uuJcpVn)`B3D zT(3Y2YMfY#V{KoHt#o21@T}SbYomj|6BTMJPCC@C^okh99r}!3O)>cE1rvL1SjR|fkb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YvDT7ON=s5|e7tuIJz;Q@lkkf`w{o@zpOuwL_}I5=5EC zan&M zMx0ng>yu$T@5J8po~6uFal#J2^?)8mMlqKW8QOqefEy0Y$;XIV=~bl`B1aP_!U>0J ze6z9$lT5QB&DTt^-#B!`r83Vm4dJ)w6-9X0p$kl^B3&6jP0gY*@nhPrRAI-b{~ybf}7AO~_zU>lJ81o)e34tp0Pc zJDk{Y9Mqby#i3IoUu%Z-69-#muV}%q9lA+>MlI0GRQq^~79=taV=-rzeJ)nRG%Mcq zt8r?x17^hwt{p^InBrBUxZ%W9W)wd+X>a^AHELT~+hUipa&>DIX(hqlW`M9Oywmes2u1X9y}f%=R!xhbcN|jPm40*?-JYl{tlcn)DQV zW>_!NeGR%H)G{=o>=4^w;e!>V?O6?ova6fzZnk?U9CYsz>KY7^KZ8`2m|%N??J3q7 z_RO$7>!_Lvq#6aOMuo^uF+yxdS-X{5?qP-r4o|Rsob?sf%dGE9H3?1QLabrdK}{7M zWP5_`3AU%m&M>Cfo?&~2ZMe9COGQI$TTzB6LpRweMmO7otP^qD?V}aUu!am(V#atD zxyFofoa{l5@=UPKcwfO50|`n)=CkM`RXOm#MB2@|50Byp+_K z1JaY8Inn~Z@+2qzleAw``fb-d=}!%%%REZI<^7m+dqP}4A^Xk*rT^ue5zaXyUG7iE zmTO+J|KjzN#%&dqa6_~63W}{vBtarb-vE-H?o`qu+DRpfY3G;p0Ye)g)N?QCgC&Qw zj`kLbdgPHd(3>FX*)Jq*q7jllRZ2+PP)7A@u!pn`y)f|@WtteF%uKvN(M(*R+CjYK zCJ5qf`&_|aYx{7wU%jh8L@l3>;W@b*x9||wi=!A2`|+YUOuwV_o8a>vIT5>9IGGg4 z*Bc)i?#OAgd;VSa;=`|b=@> new NullReferenceException(nameof(projectPath))); + Guard.AgainstEmptyString(projectPath, () => new NullReferenceException(nameof(projectPath))); - projectPath = projectPath.ToUnixPath(); - var folderIndex = projectPath.IndexOf(RESOURCES_FOLDER_PATH, StringComparison.OrdinalIgnoreCase); + projectPath = projectPath.ToUnixPath(); + var folderIndex = projectPath.IndexOf(RESOURCES_FOLDER_PATH, StringComparison.OrdinalIgnoreCase); - Guard.AgainstEqual(folderIndex, -1, () => new PathDoesNotContainResourcesFolder(projectPath)); + Guard.AgainstEqual(folderIndex, -1, () => new PathDoesNotContainResourcesFolder(projectPath)); - folderIndex += RESOURCES_FOLDER_PATH.Length; - var length = projectPath.Length - folderIndex; - length -= projectPath.Length - projectPath.LastIndexOf('.'); + folderIndex += RESOURCES_FOLDER_PATH.Length; + var length = projectPath.Length - folderIndex; + length -= projectPath.Length - projectPath.LastIndexOf('.'); - return projectPath.Substring(folderIndex, length); - } + return projectPath.Substring(folderIndex, length); } } } \ No newline at end of file diff --git a/package.json b/package.json index 5bc3bdc..a4e6bb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.depra.assets.unity", - "version": "0.2.3", + "version": "0.2.4", "displayName": "Depra.Assets", "description": "Provides an API for loading Unity asset files in multiple ways through a single interface.", "unity": "2021.3",