title: Automatically add all declared class variables to list
body: <p>I am trying to automatically list all declared variables on my class. I am working on a pooling script, so for each gameobject I have a prefab, an array, an array size and a pool size. (they all follow naming standards, prefab name + "array" for array and etc).</p>
  
  <pre><code>private GameObject _PlayerLaserPrefab;
  private GameObject[] _PlayerLaserPrefabArray;
  private int _PlayerLaserPrefabPoolsize = 30;
  private Queue&lt;Transform&gt; _PlayerLaserPrefabQueue = new Queue&lt;Transform&gt;();
  
  
  
  private void Initiate_PlayerLaserPrefabPool()
  {
      _PlayerLaserPrefabArray = new GameObject[_PlayerLaserPrefabPoolsize];
      for (int i = 0; i &lt; _PlayerLaserPrefabPoolsize; i++)
      {
          _
      PlayerLaserPrefabArray[i] = Instantiate(_PlayerLaserPrefab,Vector3.zero, 
                                           Quaternion.identity) as GameObject;
          Transform Obj=PlayerLaserPrefabArray[i].GetComponent&lt;Transform&gt;();
          ObjTransform1.parent = transform;
          _PlayerLaserPrefabQueue.Enqueue(ObjTransform1);
          _PlayerLaserPrefabArray[i].SetActive(false);
  
      }
  }
  </code></pre>
  
  <p>this code has to be repeated for all game´s objects so I am looking for a method to dynamically generate these funcions and variables based on the object´s name.</p>
  
  <p>//pseudo code would be:</p>
  
  <pre><code>foreach (gameobject in list)
  create array
  create queue
  initiate pool
  Generate spawn function
  </code></pre>