title: Im having trouble with increasing the speed that the prefabs over time (every second)(Unity)
body: <p>The float increases over time but then it doesnt keep it on the one that spawns next so for ex Meteor 1 = -2.5 speed when it gets destroyed then Meteor 2 = -2.5 when it spawns
  but my game is making them all spawn at -2 speed
  this is the code for the mover itself</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class MeteorMover : MonoBehaviour
  {
      public float speed = -2f;
      
      
      Rigidbody2D rigidBody;
  
      // Start is called before the first frame update
      IEnumerator Start()
      {
          
          rigidBody = GetComponent&lt;Rigidbody2D&gt;();
          // Give meteor an initial downward velocity 
          rigidBody.velocity = new Vector2(0, speed);
          
  
          WaitForSeconds wait = new WaitForSeconds(1);
          int time = 1;
          while (time &gt; 0)
          {
              speed -= .1f;
              time++;
             //yield return speed;
              yield return wait;
          }
          //yield return speed;
          yield return wait;
      }   
  }
  </code></pre>
  <p>Then the spawners script</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class MeteorSpawn : MonoBehaviour
  {
      public GameObject meteorPrefab;
      public float minSpawnDelay = 1f;
      public float maxSpawnDelay = 3f;
      public float spawnXLimit = 6f;
  
      // Start is called before the first frame update
      void Start()
      {
          Spawn();
      }
  
      void Spawn()
      {
          // Create a meteor at a random x position
          float random = Random.Range(-spawnXLimit, spawnXLimit);
          Vector3 spawnPos = transform.position + new Vector3(random, 0f, 0f);
          Instantiate(meteorPrefab, spawnPos, Quaternion.identity);
          
          Invoke(&quot;Spawn&quot;, Random.Range(minSpawnDelay, maxSpawnDelay));
      }
  }
  </code></pre>