mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-21 16:00:32 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb743ada63 | ||
|
|
a17e742218 | ||
|
|
d6b54dd49c | ||
|
|
b7a20d4bdb | ||
|
|
28c22694ba | ||
|
|
efd0789e09 | ||
|
|
d8b1396641 | ||
|
|
ef46b4365d | ||
|
|
0d7c93ac55 | ||
|
|
25088918d3 | ||
|
|
bed435794e | ||
|
|
ca6b6899a5 | ||
|
|
33a0f7023c | ||
|
|
60509a4a22 | ||
|
|
4b39af0543 |
@@ -2,5 +2,24 @@
|
|||||||
|
|
||||||
All notable changes to this package will be documented in this file.
|
All notable changes to this package will be documented in this file.
|
||||||
|
|
||||||
## [v1.0.0-preview] - 2022-04-05
|
## [1.0.2] - 2022-04-07
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- 修复在资源加载完成回调内释放自身资源句柄时的异常报错。
|
||||||
|
- 修复了资源分组在特殊情况下打包报错的问题。
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- StreamingAssets目录下增加了用于存放打包资源的总文件夹
|
||||||
|
|
||||||
|
## [1.0.1] - 2022-04-07
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- 修复Assets目录下存在多个YooAsset同名文件夹时,工具窗口无法显示的问题。
|
||||||
|
- 修复通过Packages导入YooAsset,工具窗口无法显示的问题。
|
||||||
|
|
||||||
|
## [1.0.0] - 2022-04-05
|
||||||
*Compatible with Unity 2019.4*
|
*Compatible with Unity 2019.4*
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,14 @@ namespace YooAsset.Editor
|
|||||||
return $"{projectPath}/Bundles";
|
return $"{projectPath}/Bundles";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取流文件夹路径
|
||||||
|
/// </summary>
|
||||||
|
public static string GetStreamingAssetsFolderPath()
|
||||||
|
{
|
||||||
|
return $"{Application.dataPath}/StreamingAssets/YooAssets/";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取构建管线的输出目录
|
/// 获取构建管线的输出目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -30,8 +38,8 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void ClearStreamingAssetsFolder()
|
public static void ClearStreamingAssetsFolder()
|
||||||
{
|
{
|
||||||
string streamingPath = Application.dataPath + "/StreamingAssets";
|
string streamingFolderPath = GetStreamingAssetsFolderPath();
|
||||||
EditorTools.ClearFolder(streamingPath);
|
EditorTools.ClearFolder(streamingFolderPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -40,17 +48,17 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void DeleteStreamingAssetsIgnoreFiles()
|
public static void DeleteStreamingAssetsIgnoreFiles()
|
||||||
{
|
{
|
||||||
string streamingPath = Application.dataPath + "/StreamingAssets";
|
string streamingFolderPath = GetStreamingAssetsFolderPath();
|
||||||
if (Directory.Exists(streamingPath))
|
if (Directory.Exists(streamingFolderPath))
|
||||||
{
|
{
|
||||||
string[] files = Directory.GetFiles(streamingPath, "*.manifest", SearchOption.AllDirectories);
|
string[] files = Directory.GetFiles(streamingFolderPath, "*.manifest", SearchOption.AllDirectories);
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
FileInfo info = new FileInfo(file);
|
FileInfo info = new FileInfo(file);
|
||||||
info.Delete();
|
info.Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
files = Directory.GetFiles(streamingPath, "*.meta", SearchOption.AllDirectories);
|
files = Directory.GetFiles(streamingFolderPath, "*.meta", SearchOption.AllDirectories);
|
||||||
foreach (var item in files)
|
foreach (var item in files)
|
||||||
{
|
{
|
||||||
FileInfo info = new FileInfo(item);
|
FileInfo info = new FileInfo(item);
|
||||||
|
|||||||
@@ -89,10 +89,7 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string GetAppendExtension()
|
public string GetAppendExtension()
|
||||||
{
|
{
|
||||||
if (IsRawFile)
|
return System.IO.Path.GetExtension(BundleName);
|
||||||
return $".{YooAssetSettingsData.Setting.RawFileVariant}";
|
|
||||||
else
|
|
||||||
return $".{YooAssetSettingsData.Setting.AssetBundleFileVariant}";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace YooAsset.Editor
|
|||||||
if (buildAssetInfo.BundleNameIsValid() == false)
|
if (buildAssetInfo.BundleNameIsValid() == false)
|
||||||
{
|
{
|
||||||
string bundleName = defaultPackRule.GetBundleName(new PackRuleData(buildAssetInfo.AssetPath));
|
string bundleName = defaultPackRule.GetBundleName(new PackRuleData(buildAssetInfo.AssetPath));
|
||||||
bundleName = AssetBundleCollector.RevisedBundleName(bundleName);
|
bundleName = AssetBundleCollector.RevisedBundleName(bundleName, false);
|
||||||
buildAssetInfo.SetBundleName(bundleName);
|
buildAssetInfo.SetBundleName(bundleName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace YooAsset.Editor
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
string sourcePath = $"{pipelineOutputDirectory}/{patchBundle.BundleName}";
|
string sourcePath = $"{pipelineOutputDirectory}/{patchBundle.BundleName}";
|
||||||
string destPath = $"{Application.dataPath}/StreamingAssets/{patchBundle.Hash}";
|
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{patchBundle.Hash}";
|
||||||
Debug.Log($"拷贝内置文件到流目录:{patchBundle.BundleName}");
|
Debug.Log($"拷贝内置文件到流目录:{patchBundle.BundleName}");
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
}
|
}
|
||||||
@@ -46,14 +46,14 @@ namespace YooAsset.Editor
|
|||||||
// 拷贝清单文件
|
// 拷贝清单文件
|
||||||
{
|
{
|
||||||
string sourcePath = $"{pipelineOutputDirectory}/{YooAssetSettingsData.Setting.PatchManifestFileName}";
|
string sourcePath = $"{pipelineOutputDirectory}/{YooAssetSettingsData.Setting.PatchManifestFileName}";
|
||||||
string destPath = $"{Application.dataPath}/StreamingAssets/{YooAssetSettingsData.Setting.PatchManifestFileName}";
|
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{YooAssetSettingsData.Setting.PatchManifestFileName}";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拷贝清单哈希文件
|
// 拷贝清单哈希文件
|
||||||
{
|
{
|
||||||
string sourcePath = $"{pipelineOutputDirectory}/{YooAssetSettingsData.Setting.PatchManifestHashFileName}";
|
string sourcePath = $"{pipelineOutputDirectory}/{YooAssetSettingsData.Setting.PatchManifestHashFileName}";
|
||||||
string destPath = $"{Application.dataPath}/StreamingAssets/{YooAssetSettingsData.Setting.PatchManifestHashFileName}";
|
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{YooAssetSettingsData.Setting.PatchManifestHashFileName}";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace YooAsset.Editor
|
|||||||
continue;
|
continue;
|
||||||
if (result.ContainsKey(assetPath) == false)
|
if (result.ContainsKey(assetPath) == false)
|
||||||
{
|
{
|
||||||
string bundleName = GetBundleName(grouper, assetPath);
|
string bundleName = GetBundleName(grouper, assetPath, isRawAsset);
|
||||||
List<string> assetTags = GetAssetTags(grouper);
|
List<string> assetTags = GetAssetTags(grouper);
|
||||||
var collectAssetInfo = new CollectAssetInfo(bundleName, assetPath, assetTags, isRawAsset, NotWriteToAssetList);
|
var collectAssetInfo = new CollectAssetInfo(bundleName, assetPath, assetTags, isRawAsset, NotWriteToAssetList);
|
||||||
collectAssetInfo.DependAssets = GetAllDependencies(assetPath);
|
collectAssetInfo.DependAssets = GetAllDependencies(assetPath);
|
||||||
@@ -91,7 +91,7 @@ namespace YooAsset.Editor
|
|||||||
if (isRawAsset && NotWriteToAssetList)
|
if (isRawAsset && NotWriteToAssetList)
|
||||||
UnityEngine.Debug.LogWarning($"Are you sure raw file are not write to asset list : {assetPath}");
|
UnityEngine.Debug.LogWarning($"Are you sure raw file are not write to asset list : {assetPath}");
|
||||||
|
|
||||||
string bundleName = GetBundleName(grouper, assetPath);
|
string bundleName = GetBundleName(grouper, assetPath, isRawAsset);
|
||||||
List<string> assetTags = GetAssetTags(grouper);
|
List<string> assetTags = GetAssetTags(grouper);
|
||||||
var collectAssetInfo = new CollectAssetInfo(bundleName, assetPath, assetTags, isRawAsset, NotWriteToAssetList);
|
var collectAssetInfo = new CollectAssetInfo(bundleName, assetPath, assetTags, isRawAsset, NotWriteToAssetList);
|
||||||
result.Add(assetPath, collectAssetInfo);
|
result.Add(assetPath, collectAssetInfo);
|
||||||
@@ -139,7 +139,7 @@ namespace YooAsset.Editor
|
|||||||
IFilterRule filterRuleInstance = AssetBundleGrouperSettingData.GetFilterRuleInstance(FilterRuleName);
|
IFilterRule filterRuleInstance = AssetBundleGrouperSettingData.GetFilterRuleInstance(FilterRuleName);
|
||||||
return filterRuleInstance.IsCollectAsset(new FilterRuleData(assetPath));
|
return filterRuleInstance.IsCollectAsset(new FilterRuleData(assetPath));
|
||||||
}
|
}
|
||||||
private string GetBundleName(AssetBundleGrouper grouper, string assetPath)
|
private string GetBundleName(AssetBundleGrouper grouper, string assetPath, bool isRawAsset)
|
||||||
{
|
{
|
||||||
// 如果收集全路径着色器
|
// 如果收集全路径着色器
|
||||||
if (AssetBundleGrouperSettingData.Setting.AutoCollectShaders)
|
if (AssetBundleGrouperSettingData.Setting.AutoCollectShaders)
|
||||||
@@ -147,14 +147,17 @@ namespace YooAsset.Editor
|
|||||||
System.Type assetType = AssetDatabase.GetMainAssetTypeAtPath(assetPath);
|
System.Type assetType = AssetDatabase.GetMainAssetTypeAtPath(assetPath);
|
||||||
if (assetType == typeof(UnityEngine.Shader))
|
if (assetType == typeof(UnityEngine.Shader))
|
||||||
{
|
{
|
||||||
return RevisedBundleName(AssetBundleGrouperSettingData.Setting.ShadersBundleName);
|
string bundleName = AssetBundleGrouperSettingData.Setting.ShadersBundleName;
|
||||||
|
return RevisedBundleName(bundleName, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据规则设置获取资源包名称
|
// 根据规则设置获取资源包名称
|
||||||
IPackRule packRuleInstance = AssetBundleGrouperSettingData.GetPackRuleInstance(PackRuleName);
|
{
|
||||||
string bundleName = packRuleInstance.GetBundleName(new PackRuleData(assetPath, CollectPath, grouper.GrouperName));
|
IPackRule packRuleInstance = AssetBundleGrouperSettingData.GetPackRuleInstance(PackRuleName);
|
||||||
return RevisedBundleName(bundleName);
|
string bundleName = packRuleInstance.GetBundleName(new PackRuleData(assetPath, CollectPath, grouper.GrouperName));
|
||||||
|
return RevisedBundleName(bundleName, isRawAsset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private List<string> GetAssetTags(AssetBundleGrouper grouper)
|
private List<string> GetAssetTags(AssetBundleGrouper grouper)
|
||||||
{
|
{
|
||||||
@@ -183,9 +186,18 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 修正资源包名
|
/// 修正资源包名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string RevisedBundleName(string bundleName)
|
public static string RevisedBundleName(string bundleName, bool isRawBundle)
|
||||||
{
|
{
|
||||||
return EditorTools.GetRegularPath(bundleName).ToLower();
|
if (isRawBundle)
|
||||||
|
{
|
||||||
|
string fullName = $"{bundleName}.{YooAssetSettingsData.Setting.RawFileVariant}";
|
||||||
|
return EditorTools.GetRegularPath(fullName).ToLower();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string fullName = $"{bundleName}.{YooAssetSettingsData.Setting.AssetBundleFileVariant}";
|
||||||
|
return EditorTools.GetRegularPath(fullName).ToLower(); ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class EditorTools
|
public static class EditorTools
|
||||||
{
|
{
|
||||||
#region Assembly
|
#region Assembly
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 调用私有的静态方法
|
/// 调用私有的静态方法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -49,9 +49,9 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
return methodInfo.Invoke(null, parameters);
|
return methodInfo.Invoke(null, parameters);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region EditorUtility
|
#region EditorUtility
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 搜集资源
|
/// 搜集资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -156,9 +156,9 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
EditorUtility.ClearProgressBar();
|
EditorUtility.ClearProgressBar();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region EditorWindow
|
#region EditorWindow
|
||||||
public static void FocusUnitySceneWindow()
|
public static void FocusUnitySceneWindow()
|
||||||
{
|
{
|
||||||
EditorWindow.FocusWindowIfItsOpen<SceneView>();
|
EditorWindow.FocusWindowIfItsOpen<SceneView>();
|
||||||
@@ -188,9 +188,9 @@ namespace YooAsset.Editor
|
|||||||
System.Type T = Assembly.Load("UnityEditor").GetType("UnityEditor.ConsoleWindow");
|
System.Type T = Assembly.Load("UnityEditor").GetType("UnityEditor.ConsoleWindow");
|
||||||
EditorWindow.GetWindow(T, false, "Console", true);
|
EditorWindow.GetWindow(T, false, "Console", true);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 控制台
|
#region 控制台
|
||||||
private static MethodInfo _clearConsoleMethod;
|
private static MethodInfo _clearConsoleMethod;
|
||||||
private static MethodInfo ClearConsoleMethod
|
private static MethodInfo ClearConsoleMethod
|
||||||
{
|
{
|
||||||
@@ -213,9 +213,9 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
ClearConsoleMethod.Invoke(new object(), null);
|
ClearConsoleMethod.Invoke(new object(), null);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 文件
|
#region 文件
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建文件所在的目录
|
/// 创建文件所在的目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -409,9 +409,9 @@ namespace YooAsset.Editor
|
|||||||
else
|
else
|
||||||
return Encoding.UTF8.GetString(bytes.ToArray());
|
return Encoding.UTF8.GetString(bytes.ToArray());
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 路径
|
#region 路径
|
||||||
private static string YooAssetPath;
|
private static string YooAssetPath;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -430,26 +430,40 @@ namespace YooAsset.Editor
|
|||||||
if (string.IsNullOrEmpty(YooAssetPath) == false)
|
if (string.IsNullOrEmpty(YooAssetPath) == false)
|
||||||
return YooAssetPath;
|
return YooAssetPath;
|
||||||
|
|
||||||
string packagesPath = ("Packages/com.tuyoo.yooasset/README.md");
|
// 从Pakcages目录下搜索
|
||||||
|
string packagesPath = ("Packages/com.tuyoogame.yooasset/README.md");
|
||||||
var obj = AssetDatabase.LoadAssetAtPath(packagesPath, typeof(TextAsset));
|
var obj = AssetDatabase.LoadAssetAtPath(packagesPath, typeof(TextAsset));
|
||||||
if(obj != null)
|
if (obj != null)
|
||||||
{
|
{
|
||||||
YooAssetPath = "Packages/com.tuyoo.yooasset/";
|
YooAssetPath = "Packages/com.tuyoogame.yooasset/";
|
||||||
return YooAssetPath;
|
return YooAssetPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 从Assets目录下搜索
|
||||||
string[] allDirectorys = Directory.GetDirectories(Application.dataPath, "YooAsset", SearchOption.AllDirectories);
|
string[] allDirectorys = Directory.GetDirectories(Application.dataPath, "YooAsset", SearchOption.AllDirectories);
|
||||||
if (allDirectorys.Length == 0)
|
if (allDirectorys.Length == 0)
|
||||||
{
|
{
|
||||||
Debug.LogError("Not found YooAsset Folder!");
|
Debug.LogError("Not found YooAsset Package !");
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
if (allDirectorys.Length > 1)
|
|
||||||
|
string targetDirectory = string.Empty;
|
||||||
|
foreach (var directory in allDirectorys)
|
||||||
{
|
{
|
||||||
Debug.LogError("Found multiple YooAsset Folders!");
|
string asmdefFilePath = $"{directory}/Editor/YooAsset.Editor.asmdef";
|
||||||
|
if (File.Exists(asmdefFilePath))
|
||||||
|
{
|
||||||
|
targetDirectory = directory;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(targetDirectory))
|
||||||
|
{
|
||||||
|
Debug.LogError("Should never get here !");
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
YooAssetPath = AbsolutePathToAssetPath(allDirectorys[0]);
|
|
||||||
|
YooAssetPath = AbsolutePathToAssetPath(targetDirectory);
|
||||||
return YooAssetPath;
|
return YooAssetPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,9 +518,9 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 字符串
|
#region 字符串
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否含有中文
|
/// 是否含有中文
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -567,9 +581,9 @@ namespace YooAsset.Editor
|
|||||||
else
|
else
|
||||||
return content.Substring(startIndex + key.Length);
|
return content.Substring(startIndex + key.Length);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 玩家偏好
|
#region 玩家偏好
|
||||||
// 枚举
|
// 枚举
|
||||||
public static void PlayerSetEnum<T>(string key, T value)
|
public static void PlayerSetEnum<T>(string key, T value)
|
||||||
{
|
{
|
||||||
@@ -581,6 +595,6 @@ namespace YooAsset.Editor
|
|||||||
string enumName = EditorPrefs.GetString(key, defaultValue.ToString());
|
string enumName = EditorPrefs.GetString(key, defaultValue.ToString());
|
||||||
return StringUtility.NameToEnum<T>(enumName);
|
return StringUtility.NameToEnum<T>(enumName);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 46c04934b6325ae4eaf66ae32034e329
|
guid: 3fec07d458534d34ea14d1b1a0a5100b
|
||||||
DefaultImporter:
|
TextScriptImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
@@ -11,10 +11,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
internal override void InvokeCallback()
|
internal override void InvokeCallback()
|
||||||
{
|
{
|
||||||
if (IsValid)
|
_callback?.Invoke(this);
|
||||||
{
|
|
||||||
_callback?.Invoke(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -11,10 +11,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
internal override void InvokeCallback()
|
internal override void InvokeCallback()
|
||||||
{
|
{
|
||||||
if (IsValid)
|
_callback?.Invoke(this);
|
||||||
{
|
|
||||||
_callback?.Invoke(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -10,10 +10,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
internal override void InvokeCallback()
|
internal override void InvokeCallback()
|
||||||
{
|
{
|
||||||
if (IsValid)
|
_callback?.Invoke(this);
|
||||||
{
|
|
||||||
_callback?.Invoke(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -224,9 +224,14 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
protected void InvokeCompletion()
|
protected void InvokeCompletion()
|
||||||
{
|
{
|
||||||
foreach (var handle in _handles)
|
// 注意:创建临时列表是为了防止外部逻辑在回调函数内创建或者释放资源句柄。
|
||||||
|
List<OperationHandleBase> tempers = new List<OperationHandleBase>(_handles);
|
||||||
|
foreach (var hande in tempers)
|
||||||
{
|
{
|
||||||
handle.InvokeCallback();
|
if (hande.IsValid)
|
||||||
|
{
|
||||||
|
hande.InvokeCallback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_waitHandle?.Set();
|
_waitHandle?.Set();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string MakeStreamingLoadPath(string path)
|
public static string MakeStreamingLoadPath(string path)
|
||||||
{
|
{
|
||||||
return StringUtility.Format("{0}/{1}", UnityEngine.Application.streamingAssetsPath, path);
|
return StringUtility.Format("{0}/YooAssets/{1}", UnityEngine.Application.streamingAssetsPath, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "com.tuyoogame.yooasset",
|
"name": "com.tuyoogame.yooasset",
|
||||||
"displayName": "YooAsset",
|
"displayName": "YooAsset",
|
||||||
"version": "0.0.1-preview",
|
"version": "1.0.2",
|
||||||
"unity": "2019.4",
|
"unity": "2019.4",
|
||||||
"keywords": [ "YooAsset", "Resources", "AssetBundle" ],
|
|
||||||
"description": "unity3d resources management system",
|
"description": "unity3d resources management system",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "TuYoo Games",
|
"name": "TuYoo Games",
|
||||||
@@ -11,7 +10,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/tuyoogame/YooAsset"
|
"url": "https://github.com/tuyoogame/YooAsset.git"
|
||||||
},
|
},
|
||||||
"relatedPackages": {},
|
"relatedPackages": {},
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
|
|||||||
@@ -121,3 +121,32 @@ IEnumerator Start()
|
|||||||
}
|
}
|
||||||
````
|
````
|
||||||
|
|
||||||
|
**FairyGUI加载方案**
|
||||||
|
|
||||||
|
注意:在FairyGUI的面板销毁的时候,将资源句柄列表释放,否则会造成资源泄漏。
|
||||||
|
|
||||||
|
````c#
|
||||||
|
// 资源句柄列表
|
||||||
|
private List<AssetOperationHandle> _handles = new List<AssetOperationHandle>(100);
|
||||||
|
|
||||||
|
// 加载方法
|
||||||
|
private object LoadFunc(string name, string extension, System.Type type, out DestroyMethod method)
|
||||||
|
{
|
||||||
|
method = DestroyMethod.None;
|
||||||
|
string location = $"FairyRes/{name}{extension}";
|
||||||
|
var handle = YooAssets.LoadAssetSync(location , type);
|
||||||
|
_handles.Add(handle);
|
||||||
|
return handle.AssetObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 释放资源句柄列表
|
||||||
|
private void ReleaseHandles()
|
||||||
|
{
|
||||||
|
foreach(var handle in _handles)
|
||||||
|
{
|
||||||
|
handle.Release();
|
||||||
|
}
|
||||||
|
_handles.Clear();
|
||||||
|
}
|
||||||
|
````
|
||||||
|
|
||||||
|
|||||||
BIN
Docs/Image/QuickStart-img1.jpg
Normal file
BIN
Docs/Image/QuickStart-img1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
BIN
Docs/Image/QuickStart-img2.jpg
Normal file
BIN
Docs/Image/QuickStart-img2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
@@ -1,12 +1,51 @@
|
|||||||
# 快速开始
|
# 快速开始
|
||||||
|
|
||||||
**下载安装**
|
#### **下载安装**
|
||||||
|
|
||||||
1. 通过OpenUPM安装
|
1. **通过PackageManager安装**
|
||||||
2. 通过Packages安装
|
|
||||||
3. 通过GIT安装
|
|
||||||
|
|
||||||
**系统需求**
|
打开管理界面 **Edit/Project Settings/Package Manager**
|
||||||
|
|
||||||
|
````
|
||||||
|
// 输入以下内容
|
||||||
|
Name: package.openupm.cn
|
||||||
|
URL: https://package.openupm.cn
|
||||||
|
Scope(s): com.tuyoogame.yooasset
|
||||||
|
````
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
打开管理界面 **Edit/Windows/Package Manager**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
2. **通过Packages清单安装**
|
||||||
|
|
||||||
|
直接修改Packages文件夹下的清单文件manifest.json
|
||||||
|
|
||||||
|
````json
|
||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"com.tuyoogame.yooasset": "0.0.1-preview",
|
||||||
|
......
|
||||||
|
},
|
||||||
|
"scopedRegistries": [
|
||||||
|
{
|
||||||
|
"name": "package.openupm.cn",
|
||||||
|
"url": "https://package.openupm.cn",
|
||||||
|
"scopes": [
|
||||||
|
"com.tuyoogame.yooasset"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
````
|
||||||
|
|
||||||
|
3. **通过Github下载安装**
|
||||||
|
|
||||||
|
在发布的Release版本中,选择最新版本下载Source Code压缩包。
|
||||||
|
|
||||||
|
#### **系统需求**
|
||||||
|
|
||||||
支持版本: Unity2019.4+
|
支持版本: Unity2019.4+
|
||||||
|
|
||||||
@@ -14,7 +53,7 @@
|
|||||||
|
|
||||||
开发环境: .NET4.x
|
开发环境: .NET4.x
|
||||||
|
|
||||||
**目录结构**
|
#### **目录结构**
|
||||||
|
|
||||||
````
|
````
|
||||||
Assets
|
Assets
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -1,7 +1,9 @@
|
|||||||
[](https://github.com/tuyoogame/YooAsset/blob/master/LICENSE)
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
# YooAsset
|
||||||
|
|
||||||
|
[](https://github.com/tuyoogame/YooAsset/blob/master/LICENSE)[](https://openupm.cn/packages/com.tuyoogame.yooasset/)
|
||||||
|
|
||||||
**YooAsset**是一套用于Unity3D的资源管理系统,用于帮助研发团队快速部署和交付游戏。
|
**YooAsset**是一套用于Unity3D的资源管理系统,用于帮助研发团队快速部署和交付游戏。
|
||||||
|
|
||||||
它可以满足商业化游戏的各类需求,并且经历多款百万DAU游戏产品的验证。
|
它可以满足商业化游戏的各类需求,并且经历多款百万DAU游戏产品的验证。
|
||||||
@@ -57,7 +59,12 @@
|
|||||||
|
|
||||||
Coming soon...
|
Coming soon...
|
||||||
|
|
||||||
|
### 社区
|
||||||
|
|
||||||
|
**QQ群:963240451**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 友情链接
|
### 友情链接
|
||||||
|
|
||||||
[huatuo](https://github.com/focus-creative-games/huatuo):华佗是一个**特性完整、零成本、高性能、低内存**的近乎完美的c#热更新方案。
|
[huatuo](https://github.com/focus-creative-games/huatuo):华佗是一个**特性完整、零成本、高性能、低内存**的近乎完美的c#热更新方案。
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user