mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Remove AssetTag
Remove AssetTag
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 854f63fe041d43f0ab0f76b1059eab89
|
||||
timeCreated: 1680592471
|
@@ -310,7 +310,6 @@ namespace TEngine
|
||||
if (typeof(T) == typeof(GameObject))
|
||||
{
|
||||
GameObject ret = handle.InstantiateSync();
|
||||
BindAssetTag(ret, handle, assetName);
|
||||
return ret as T;
|
||||
}
|
||||
else
|
||||
@@ -338,7 +337,6 @@ namespace TEngine
|
||||
if (typeof(T) == typeof(GameObject))
|
||||
{
|
||||
GameObject ret = handle.InstantiateSync(parent);
|
||||
BindAssetTag(ret, handle, assetName);
|
||||
return ret as T;
|
||||
}
|
||||
else
|
||||
@@ -432,8 +430,6 @@ namespace TEngine
|
||||
await handle.ToUniTask(cancellationToken:cancellationToken);
|
||||
|
||||
GameObject ret = handle.InstantiateSync();
|
||||
|
||||
BindAssetTag(ret, handle, assetName);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -485,22 +481,5 @@ namespace TEngine
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user