title: How can I switch toggle Input.GetKeyDown in unity?
body: <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class DroidMove : MonoBehaviour
  {
      public GameObject droid;
  
      private void Start()
      {
          droid.SetActive(false);
      }
  
      private void Update()
      {
          if (Input.GetKeyDown(KeyCode.D))
          {
              droid.transform.position = droid.transform.position - transform.forward;
              droid.SetActive(true);
          }
      }
  }
  </code></pre>
  
  <p>I want that once I click on D it will show the Droid and also when I move the camera(transform) the droid will follow the camera.</p>
  
  <p>And when I click once again on D set the droid active to false so each time I click on D it will toggle between SetActive false and true.</p>