title: how to update only once in unity
body: <p>Hello i have a code which moves my main camera to other game objects positions when i press button like if i press button 1 it will move towards object 1 position same for button 2 and 3. Now in my code i have a boolean named as flag which is true in update function then i have multiple public functions for multiple buttons now when i press any button the boolean becomes true and remains true which causes camera to shake because boolean is continously updating please tell me a way that when my camera reaches it final position the flag boolean becomes false and when again i press another button i will become true again here is my code</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  
  public class camMOVE : MonoBehaviour {
  
  public Transform  handleview;
  public Transform pressureview;
  public Transform wallview;
  public Transform sechandleview;
  public Transform pressuretwoview;
  public Transform switchview;
  
  public GameObject handlebtn;
  public GameObject pressurebtn;
  public GameObject wallbtn;
  public GameObject handletwobtn;
  public GameObject pressuretwobtn;
  public GameObject switchbtn;
  
  public GameObject parentobj;
  Animator anim;
  
  public float transitionSPEED;
  Transform currentVIEW;
  private bool flag = false;
  Vector3 currentangel;
  public List&lt;GameObject&gt; modelparts;
  
  private void Start(){
      handlebtn.SetActive (true);
      pressurebtn.SetActive (false);
      wallbtn.SetActive (false);
      handletwobtn.SetActive (false);
      pressuretwobtn.SetActive (false);
      switchbtn.SetActive (false);
  
      anim = parentobj.GetComponent&lt;Animator&gt; ();
      anim.SetBool ("start", true);
  
      //currentVIEW = handleview;
      foreach (GameObject obj in modelparts) {
  
          obj.GetComponent&lt;BoxCollider&gt; ().enabled = false;
      }
  }
  
  private void Update(){
      if (flag == true) {
          transform.position = Vector3.Lerp (transform.position, 
  currentVIEW.position, Time.deltaTime * transitionSPEED);
  
      currentangel = new Vector3 (Mathf.LerpAngle 
  (transform.rotation.eulerAngles.x, currentVIEW.transform.rotation.eulerAngles.x, Time.deltaTime * transitionSPEED),
              Mathf.LerpAngle (transform.rotation.eulerAngles.y, currentVIEW.transform.rotation.eulerAngles.y, Time.deltaTime * transitionSPEED),
              Mathf.LerpAngle (transform.rotation.eulerAngles.z, currentVIEW.transform.rotation.eulerAngles.z, Time.deltaTime * transitionSPEED));
  
          transform.eulerAngles = currentangel;
      }
  }
  
  public void Handleview(){
      currentVIEW = handleview;
      handlebtn.SetActive (false);
      flag = true;
  }
  
  public void Pressureview(){
      currentVIEW = pressureview;
      pressurebtn.SetActive (false);
      flag = true;
  }
  
  public void Wallview(){
      currentVIEW = wallview;
      wallbtn.SetActive (false);
      flag = true;
  }
  
  public void Secondhandleview(){
      currentVIEW = sechandleview;
      handletwobtn.SetActive (false);
      flag = true;
  }
  
  public void Pressuretwoview(){
      currentVIEW = pressuretwoview;
      pressuretwobtn.SetActive (false);
      flag = true;
  }
  
  public void Switchview(){
      currentVIEW = switchview;
      switchbtn.SetActive (false);
      flag = true;
  }
  </code></pre>
  
  <p>}</p>