2D-Platformer/Assets/Scripts/Data/AssetReferenceData.cs
2022-02-12 12:53:50 +02:00

33 lines
No EOL
817 B
C#

using DefaultNamespace;
using System;
using Unity.Entities;
using UnityEngine.ResourceManagement.AsyncOperations;
[assembly: RegisterGenericComponentType(typeof(AssetReferenceData<ItemPrefab>))]
namespace DefaultNamespace
{
public struct AssetReferenceData<T> : ISharedComponentData, IEquatable<AssetReferenceData<T>> where T : class
{
public AsyncOperationWrapper<T> Operation;
public AssetReferenceData(AsyncOperationHandle<T> operation)
{
Operation = new AsyncOperationWrapper<T>(operation);
}
public bool Equals(AssetReferenceData<T> other)
{
return Operation.Equals(other.Operation);
}
public override bool Equals(object obj)
{
return obj is AssetReferenceData<T> other && Equals(other);
}
public override int GetHashCode()
{
return Operation.GetHashCode();
}
}
}