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?
↧