is there a better way performance wise to GetComponent on pooled objects?

I’m building a 2D game for mobile and just wondering if there’s a better way to change the values of a script attached to the pooled objects.

Here is the script attached to my player Object.

	// PROJECTILE VARIABLES
	public GameObject projectile;
	public float fireRate;
	private float nextAttack;
	
	public int maxProjectiles;
	private GameObject[] pool;
	// END PROJECTILE VARIABLES
	
	void Start () {
		// INITIALIZE PROJECTILES
		pool = new GameObject[maxProjectiles];
		for (int i = 0; i < pool.Length; i++) {
			pool *= Instantiate(projectile);*

_ pool*.SetActive(false);_
_
}_
_
// END INITIALIZE PROJECTILES*_
* }*

* void Update () {*
// FIRE PROJECTILE
Projectile();

// TEST CHANGING FLOAT “DECAY” IN POOLED OBJECTS SCRIPT
if (Time.time > 1.5f) {
for (int i = 0; i < pool.Length; i++) {
pool*.GetComponent<projectile_Controls>().decay = 0.1f;
_ }
}
// END TEST*
}_

The pooled objects have a different script projectile_Controls.cs attached which contains a float decay (among other things) that controls how long a projectile stays on screen.

The reason why I need to access all the pooled objects variables is because my player will pick up different kinds of weapons throughout the game. Since I’m pooling the projectiles at the start of the game, that means I will have to change the pooled projectiles textures and variables that control speed etc. when the player acquires a new weapon.

I’d like to know how I can access the variables of the pooled objects and change them without affecting performance too much.

Another way would be to simply create a pool for each weapon type but I think that will hurt memory, especially if I decide to have a very big selection of weaponry.
What do you suggest?
Oh and the player could be changing weapons quite often. Assume every 1-10sec.

If all the pooled objects have the same script attached and that’s what you need to access, make the private GameObject[] pool into a private projectile_Controls[] pool instead and move the GetComponent into the pool creation loop.

If weapons need very different capabilities, you could use inheritance and extend projectile_Controls and this would still work as long as all the common, required functionality is in the base class.

pool = new projectile_Controls[maxProjectiles];
for (int i = 0; i < pool.Length; i++) {
    pool *= Instantiate(projectile).GetComponent<projectile_Controls>();*

pool*.gameObject.SetActive(false);*
}

for (int i = 0; i < pool.Length; i++) {
pool*.decay = 0.1f;*
}

Change: public GameObject projectile

variable type from GameObject to projectile_Controls:

public projectile_Controls projectile

This way, you can access public variables like: projectile.decay

instead of: projectile.GetComponent<projectile_Controls>().decay.

Then, when accessing the pooled objects, you can do:

 // TEST CHANGING FLOAT "DECAY" IN POOLED OBJECTS SCRIPT
 if (Time.time > 1.5f) {
	 foreach (projectile_Controls pc in pool) {
		 pc.decay = 0.1f;
	 }
 }
 // END TEST

Sorry if any syntax is wrong. I only use JavaScript…