mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
Update ResMgr
Update ResMgr
This commit is contained in:
@@ -344,11 +344,14 @@ namespace TEngine
|
||||
if (_assetPath2BundleDatas.TryGetValue(path, out bundleName))
|
||||
{
|
||||
if (!_bundleDatas.TryGetValue(bundleName, out assetBundleData))
|
||||
{
|
||||
TLogger.LogError($"Can not get AssetBundleData with AssetBundle '{bundleName}'!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TLogger.LogError($"Can not find '{path}' in any AssetBundle!");
|
||||
|
||||
}
|
||||
return assetBundleData;
|
||||
}
|
||||
}
|
||||
|
@@ -72,7 +72,9 @@ namespace TEngine
|
||||
assetData.AddRef();
|
||||
result = assetData.AssetObject as T;
|
||||
if (result != null && !_scriptableObjects.ContainsKey(result))
|
||||
{
|
||||
_scriptableObjects.Add(result, assetData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +84,9 @@ namespace TEngine
|
||||
public T Load<T>(string path) where T:UnityEngine.Object
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
T result = null;
|
||||
AssetData assetData = _assetConfig.GetAssetAtPath(path);
|
||||
@@ -112,7 +116,9 @@ namespace TEngine
|
||||
public GameObject GetGameObject(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
GameObject go = null;
|
||||
AssetData assetData = _assetConfig.GetAssetAtPath(path);
|
||||
@@ -120,7 +126,9 @@ namespace TEngine
|
||||
if (assetData != null)
|
||||
{
|
||||
go = Object.Instantiate(assetData.AssetObject) as GameObject;
|
||||
BindAssetData(go, assetData);
|
||||
{
|
||||
BindAssetData(go, assetData);
|
||||
}
|
||||
}
|
||||
|
||||
return go;
|
||||
@@ -139,7 +147,9 @@ namespace TEngine
|
||||
public byte[] GetBytesFromAsset(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] result = null;
|
||||
AssetData assetData = _assetConfig.GetAssetAtPath(path);
|
||||
|
Reference in New Issue
Block a user