public void CollectData() { //increase starting i if adding to existing system? int rockyAdded = 0; int gasyAdded = 0; int count = 0; for (int i = 0; i < CelestialObject.Objects.Count; i++) { CelestialObject co = CelestialObject.Objects[i]; if (!co.staticBody) { physicsData[count] = new _celestialObject(co, count); IcoPlanet ip = co.GetComponentInChildren <IcoPlanet>(); if (ip != null) { planetList[rockyAdded] = new _planet(ip, count); rockyAdded += 1; } GasPlanetShaderMAterialPropertyBlock gp = co.GetComponentInChildren <GasPlanetShaderMAterialPropertyBlock>(); if (gp != null) { gasPlanetList[gasyAdded] = new _gasPlanet(gp, count); gasyAdded += 1; } count += 1; } } }