您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
702 B
33 行
702 B
using System;
|
|
|
|
namespace UnityEngine.Graphing
|
|
{
|
|
public class PooledObject<T> : IDisposable where T : new()
|
|
{
|
|
private ObjectPool<T> m_ObjectPool;
|
|
|
|
public T value { get; private set; }
|
|
|
|
internal PooledObject(ObjectPool<T> objectPool, T value)
|
|
{
|
|
m_ObjectPool = objectPool;
|
|
this.value = value;
|
|
}
|
|
|
|
private void ReleaseUnmanagedResources()
|
|
{
|
|
m_ObjectPool.Release(value);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
ReleaseUnmanagedResources();
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
|
|
~PooledObject()
|
|
{
|
|
ReleaseUnmanagedResources();
|
|
}
|
|
}
|
|
}
|