Advertisement
Guest User

Untitled

a guest
Jul 24th, 2023
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. public struct PooledComponent<T> where T : MonoBehaviour {
  2.     public T Component { get; private set; }
  3.     public GameObject GameObject => pooledGameObject.gameObject;
  4.  
  5.     PooledGameObject pooledGameObject;
  6.  
  7.     public PooledComponent(PooledGameObject pooledGameObject) {
  8.         this.pooledGameObject = pooledGameObject;
  9.         Component = pooledGameObject.gameObject.GetComponent<T>();
  10.     }
  11.    
  12.     public void Release() {
  13.         Debug.Log("Releasing PC " + pooledGameObject);
  14.         pooledGameObject.Release();
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement