- Home /
 
Vector3.Lerp doesn't work on build
I'm making a scrolling menu. When I press play and play in the game view, the lerp function works fine. However, when I go to build and run, it doesn't. If this is a bug, or if my code is wrong I don't know.
Any advice would be great.
 using UnityEngine;
 using System.Collections;
 
 public class Scroll : MonoBehaviour {
 
     private Vector3 newPosition;
     public float smooth = 10f;
     public static bool leftright = true;
 
     void Awake(){
         newPosition = transform.position;
     }
     
     void Update () {
 
         Vector3 stats = new Vector3(-51.0f, 20.0f, 1.0f);
         Vector3 tools = new Vector3(100.0f, 20.0f, 1.0f);
 
         if(leftright == true)
             newPosition = stats;
         if(leftright == false)
             newPosition = tools;
 
 
         transform.position = Vector3.Lerp(transform.position, newPosition, smooth * Time.deltaTime);
     
     }
 }
 
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Weapon Movement Freezing 0 Answers
Vector3 Lerp using Time.deltaTime? 3 Answers
Smooth translation 2 Answers
Vector3.Lerp Only working once 1 Answer
Vector3 Lerp finish too quicly 1 Answer