Quantcast
Channel: Questions in topic: "clone"
Viewing all articles
Browse latest Browse all 508

How can I change this script so that each instantiated prefab spawns a set amount faster

$
0
0
How can I change this script so that each instantiated prefab spawns a set amount faster instead of increasing speed over time. e.g first clone spawns with a speed of (2.5f) then next spawned clown has a speed of (2.8f) then (3.1f) so that each clone spawns (0.3f) faster than the previous. This is my script atm: ***Side note: each clone spawns every 1.1f seconds*** using UnityEngine; using System.Collections; public class SquareMovement : MonoBehaviour { public float moveSpeed = 2.0f; public Vector3 moveDirection = Vector3.forward; void Start() { StartCoroutine("IncreaseSpeed"); } private IEnumerator IncreaseSpeed() { while (true) { moveSpeed = moveSpeed + 0.30f; yield return new WaitForSeconds(0f); } } void Update() { transform.Translate(moveDirection * moveSpeed * Time.deltaTime); } }

Viewing all articles
Browse latest Browse all 508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>