(Another) Build speed problem

Hi there!

First of all I'm french so please be nice if my english isn't perfect :)

I did a game prototype that works perfectly in Unity, but when i run the .exe file, the speed of the game is really high. The speed seems to vary with the computer that runs the .exe.

I didnt find a solution to my problem when searching in this website...

Maybe someone can help me?

Here is an example of how i make the objects moving in my game :

public var MinSpeed : float; public var MaxSpeed : float;

private var currentSpeed : float; private var x : float; private var y : float; private var z : float;

function Start(){ SetPositionAndSpeed(); }

function Update(){

var amtToMove :
float; amtToMove = currentSpeed +
transform.Translate(Vector3.down *
amtToMove); if(transform.position.y
<= -5){ SetPositionAndSpeed(); } }

public function SetPositionAndSpeed(){ currentSpeed = Random.Range(MinSpeed, MaxSpeed); x = Random.Range(-5.7f, 5.7f); y = 7f; z = 0.0f; transform.position = new Vector3(x, y, z); }

Any idea or comment would help :)

it should be

amtToMove = currentSpeed * Time.deltaTime


amtToMove = currentSpeed + Time.deltaTime;

Multiplying by the frame time changes it from distance per frame into distance per second

Thank you for your answer :)

Actually I already made this change before and it didnt work (my projectile didnt move anymore).

That was because i had made 2 public variables (minimum speed and maximum speed) which were still having a value accorded to "currentSpeed + Time.deltaTime;", so in fact my projectile was reeeaaally slow. I gave them a bigger value and now it works perfectly with your code on different computer.