- Home /
Question by
CDAXRC · Jan 15, 2018 at 09:39 AM ·
instantiatetime.time
Why time in instantiate object with this script doesn't work?
I instantiate object which have attached this script using System.Collections; using System.Collections.Generic; using UnityEngine;
public class obstacleMove : MonoBehaviour {
private static float speed = 0;
private static float moveSpeed = 1;
private Rigidbody2D rb2d;
void Awake ()
{
Time.timeScale = 1;
}
void Update (){
{
CheckUserInput ();
}
}
void CheckUserInput ()
{
if (ControlFreak2.CF2Input.GetKeyDown (KeyCode.S)) {
transform.position += new Vector3 (0, 0, 0);
}
if (Mathf.Round(Time.time * 3) - speed == moveSpeed) {
transform.position += new Vector3 (1, 0, 0);
speed = Mathf.Round(Time.time * 3);
}
As You can see in this video all circles using this same script for moving. This script work on start, on scene reload but not with instantiate object https://www.youtube.com/edit?o=U&video_id=cXyS_0cERCY
Comment
Your answer
Follow this Question
Related Questions
GameObject moving left to right AND up 1 Answer
Checking if object intersects? 1 Answer
Why isnt Time.time working when I switch scenes? 1 Answer
Instantiate and time problem 1 Answer
New GUI and Inventory problem. 1 Answer