using UnityEngine;
using System.Collections;
public class PlayerScript : MonoBehaviour {
public float moveSpeed=10;
public void Update()
{
float moveforward=moveSpeed * Time.smoothDeltaTime * Input.GetAxis(“Vertical”);
float moveLeft=moveSpeed * Time.smoothDeltaTime * Input.GetAxis(“Horizontal”);
transform.Translate(Vector3.forward * moveforward);
transform.Translate(Vector3.left * moveLeft);
}
}
You could try using a for loop to fix this
for(i=0;i<=(10*Time.smoothDeltaTime);i++)
{
//Do your code
}
Hope this helps(and works)
~ Myhijim
Change your update to this and you should get your desired functionality.
The below code when the game played will run for only 10 seconds.
void update()
{
if(Time.timeSinceLevelLoad<10f)
{
float moveforward=moveSpeed * Time.smoothDeltaTime * Input.GetAxis("Vertical");
float moveLeft=moveSpeed * Time.smoothDeltaTime * Input.GetAxis("Horizontal");
transform.Translate(Vector3.forward * moveforward); transform.Translate(Vector3.left * moveLeft);
}
}
If i am wrong in understanding what exactly you are trying to acheive then please leave quesition in the comment and i will try to help you out.