using System;
using System.Collections;
using System.Collections.Generic;
using MPStudio;
using UnityEngine;

public class AutoToPool : MonoBehaviour
{
    public float delay=5;
    
    private void OnEnable()
    {
        //回收就是它控制，不取消也不會有問題，如果還有其他invoke就有問題。
        CancelInvoke("ToPool");
        Invoke("ToPool",delay);
    }

    void ToPool()
    {
        PoolManager.Inst.RecycleGo(this.gameObject);
    }
}
