mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Update ResMgr.cs
This commit is contained in:
@@ -89,11 +89,34 @@ namespace TEngine
|
|||||||
}
|
}
|
||||||
|
|
||||||
T result = null;
|
T result = null;
|
||||||
AssetData assetData = _assetConfig.GetAssetAtPath(path);
|
|
||||||
|
AssetData assetData;
|
||||||
|
|
||||||
|
bool isSprite = false;
|
||||||
|
|
||||||
|
if (typeof(T) == typeof(Sprite))
|
||||||
|
{
|
||||||
|
isSprite = true;
|
||||||
|
assetData = _assetConfig.GetAssetAtPath(path, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
assetData = _assetConfig.GetAssetAtPath(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (assetData != null)
|
if (assetData != null)
|
||||||
|
{
|
||||||
|
if (isSprite)
|
||||||
|
{
|
||||||
|
string name = assetData.Name.Split('.')[0];
|
||||||
|
|
||||||
|
result = assetData[name] as T;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
result = assetData.AssetObject as T;
|
result = assetData.AssetObject as T;
|
||||||
|
}
|
||||||
if (result is GameObject)
|
if (result is GameObject)
|
||||||
{
|
{
|
||||||
var go = Object.Instantiate(assetData.AssetObject) as GameObject;
|
var go = Object.Instantiate(assetData.AssetObject) as GameObject;
|
||||||
|
Reference in New Issue
Block a user