Increase variable?
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?
Why is this titled "increase variable?", you obviously aren't having problems increasing them.
Please edit your question title to reflect the actual problem you are having and also edit your question body and format your code appropriately using the 101010 button.
This ensures that people can actually read your code and spot errors. Have a look at:
https://www.youtube.com/watch?v=ezAPpViLs2Q
http://answers.unity3d.com/page/faq.html
http://answers.unity3d.com/page/userguide.html
Check out tutorials about moving objects via their position. You can find them using google. For example:
http://answers.unity3d.com/questions/29751/gradually-moving-an-object-up-to-speed-rather-then.html
Please make sure your questions are matching the forums standards before you post them, some moderators will publish everything without looking at it, which is a big problem to UA.