18 lines
472 B
C#
18 lines
472 B
C#
using UniRx.Toolkit;
|
|
using UnityEngine;
|
|
|
|
public class SimpleObjectPool<T> : ObjectPool<T> where T : Component {
|
|
|
|
private readonly T prefab;
|
|
private readonly Transform parentTransform;
|
|
|
|
public SimpleObjectPool(T prefab, Transform parentTransform = null){
|
|
this.prefab = prefab;
|
|
this.parentTransform = parentTransform;
|
|
}
|
|
|
|
protected override T CreateInstance(){
|
|
return GameObject.Instantiate<T>(prefab, parentTransform);
|
|
}
|
|
}
|