Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Increase variable?

$
0
0
I created this script to increase the speed of spawninggameobject: public var goTransform:Transform; var sp:float = 0.5f;//how fast the game object is being moved var incrementTime = .1; var incrementBy = 0.05; function Awake() { goTransform = this.GetComponent(Transform); InvokeRepeating("Increment", incrementTime, incrementTime); } function Update() { goTransform.position.z = goTransform.position.z - sp; } function Increment () { sp += incrementBy; } During the simulation, if I look at the sp variable in the Inspector, the variable is increased, but the speed of gameobject remains the same. my goal is to make sure that gameobject that spawn after have a higher speed than the gameobject spawn before what should I change?

Viewing all articles
Browse latest Browse all 1875

Trending Articles



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