Remove AssetTag

Remove AssetTag
This commit is contained in:
ALEXTANG
2023-04-07 16:05:44 +08:00
parent 3366a692ed
commit af825a860e
3 changed files with 0 additions and 66 deletions

View File

@@ -1,42 +0,0 @@
using UnityEngine;
using YooAsset;
namespace TEngine
{
/// <summary>
/// 资源标识。
/// </summary>
[DisallowMultipleComponent, AddComponentMenu("")]
public sealed class AssetTag: MonoBehaviour
{
private AssetOperationHandle _operationHandle;
private int _instanceID = 0;
private string location;
private void Awake()
{
if (location != null && (_instanceID == -1 || _instanceID != gameObject.GetInstanceID()))
{
// Bind(GetAsset(operation, assetLocation));
}
}
public void Bind(AssetOperationHandle operation,string assetLocation)
{
_operationHandle = operation;
this.location = assetLocation;
_instanceID = gameObject.GetInstanceID();
}
private void OnDestroy()
{
if (_operationHandle != null)
{
_operationHandle.Release();
_operationHandle = null;
}
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 854f63fe041d43f0ab0f76b1059eab89
timeCreated: 1680592471

View File

@@ -310,7 +310,6 @@ namespace TEngine
if (typeof(T) == typeof(GameObject)) if (typeof(T) == typeof(GameObject))
{ {
GameObject ret = handle.InstantiateSync(); GameObject ret = handle.InstantiateSync();
BindAssetTag(ret, handle, assetName);
return ret as T; return ret as T;
} }
else else
@@ -338,7 +337,6 @@ namespace TEngine
if (typeof(T) == typeof(GameObject)) if (typeof(T) == typeof(GameObject))
{ {
GameObject ret = handle.InstantiateSync(parent); GameObject ret = handle.InstantiateSync(parent);
BindAssetTag(ret, handle, assetName);
return ret as T; return ret as T;
} }
else else
@@ -433,8 +431,6 @@ namespace TEngine
GameObject ret = handle.InstantiateSync(); GameObject ret = handle.InstantiateSync();
BindAssetTag(ret, handle, assetName);
return ret; return ret;
} }
@@ -485,22 +481,5 @@ namespace TEngine
{ {
return YooAssets.LoadSceneAsync(assetInfo,sceneMode,activateOnLoad,priority); return YooAssets.LoadSceneAsync(assetInfo,sceneMode,activateOnLoad,priority);
} }
private bool BindAssetTag(GameObject go,AssetOperationHandle handle,string location)
{
if (go == null)
{
throw new GameFrameworkException($"ResourceMgr BindAssetTag Failed! GameObject is null!");
}
if (handle == null)
{
throw new GameFrameworkException($"ResourceMgr BindAssetTag Failed! AssetOperationHandle is null!");
}
go.AddComponent<AssetTag>().Bind(handle,location);
return true;
}
} }
} }