| 123456789101112131415161718192021 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class PoolItem : MonoBehaviour
- {
- public GameObject prefab;
- private void OnDisable()
- {
- if (gameObject.activeSelf)
- {
- return;//防止是父物体去激活的情况
- }
- PoolManager.instance.Recycle(this);
- }
- private void OnDestroy()
- {
- PoolManager.instance.DestroyItem(this);
- }
- }
|