so I have this script
private Laser laserScript;
private Rigidbody2D rb;
public List<GameObject> pooledLasers;
public GameObject laserToPool;
public int laserAmountToPool;
private void Start()
{
laserScript = laserToPool.GetComponent<Laser>();
rb = GetComponent<Rigidbody2D>();
for (int i = 0; i < laserAmountToPool; i++)
{
GameObject laser = Instantiate(laserToPool);
laser.SetActive(false);
pooledLasers.Add(laser);
}
}
//---------------------------------------------------------------------------
and here is the Laser script attached to the GameObject in the list
//---------------------------------------------------------------------------
public int laserPower;
void Start()
{
laserPower = 1;
}
when I looked in the inspector, only the very first GameObject in the list have laserPower set to 1.
The other GameObject in the list have laserPower set to 0.