Question by 
               Venatal · Dec 01, 2015 at 02:29 PM · 
                c#instantiatespeedcounter  
              
 
              How can I increase the speed gradually of each instantiated clone.
How can I slightly increase the speed of each instantiated clone so that the speed of each clone increase by (0.3f;). each prefab has the script SquareMovement attached to it. This is my script atm:
 using UnityEngine;
 using System.Collections;
 
 public class SquareMovement : MonoBehaviour
 {
 
     private float moveSpeed = 2.5f;
 
     public Vector3 moveDirection = Vector3.forward;
 
     void Start()
     {
 
     }
 
     void Update()
     {
         transform.Translate(moveDirection * moveSpeed * Time.deltaTime);                 
     }
 
     public void IncreaseSpeed(float s)
     {
         moveSpeed += s;
     }
   
 }
 using UnityEngine;
 using System.Collections;
 
 public class TimerForIncreaseSpeed : MonoBehaviour {
 
     private float IncreaseSpeedTimer = 1.1f;
     private float SpeedToIncreaseBy = 0.3f;
 
     void Start()
     {
         InvokeRepeating("Timer", 0.001f, IncreaseSpeedTimer);
     }
 
     void Update()
     {
 
     }
 
     private void Timer()
     {
         gameObject.SendMessage("IncreaseSpeed", SpeedToIncreaseBy);
     }
 }
 
 
              
               Comment
              
 
               
              what script are you using to instantiate the prefabs from?
 using UnityEngine;
 using System.Collections;
 
 public class SpawnController : $$anonymous$$onoBehaviour
 {
     public GameObject[] SquarePrefab;
     public Quaternion[] rotations;
 
 
     void Awake()
     {
         this.enabled = false;   
     }
 
 
     IEnumerator Start()
     {
         yield return new WaitForSeconds(0.3f);
         StartCoroutine(SquareSpawn());
     }
 
     IEnumerator SquareSpawn()
     {
         while (true)
             for (int i = 0; i < 4; i++)
             {
                 int Rotation = Random.Range(0, 4);
                 int Prefab = Random.Range(0, 4);
                 Instantiate(SquarePrefab[Prefab],transform.position,rotations[Rotation]);
                 yield return new WaitForSeconds(1.1f); 
             }
     }  
 }
 
                  Your answer
 
             Follow this Question
Related Questions
How to add gameobjects to a grid? 0 Answers
How to instantiate a game object every time when space key is pressed 2 Answers
Instantiate an object until edges of floor 2 Answers
Can You help me Fix This? (Infinite level Generator) 0 Answers
Controlling Character Speed via a Public Variable? 0 Answers