title: Unity - Drag with right mouse button?
body: <p>I am creating a build in Unity 2019.4.12f1 and need to drag an object with Right Mouse button.
  My C# skills are very limited, so far but i try.</p>
  <p>This scripts is my attempt to be able to rotate a gameobject by holding right mouse button down and dragging ingame.</p>
  <p>But it is wrong.
  Can anyone help me correct it?´</p>
  <hr />
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class mouseM : MonoBehaviour
  {
       bool dragging = false;
  
       void Start()
      {
          if (Input.GetMouseButtonDown(1))
          {
              dragging = true;
          }
      }
  
      void Update()
      {
          if (Input.GetMouseButtonDown(1))
          {
              yourOnMouseDownFunction();
              dragging = true;
          }
          if (Input.GetMouseButtonUp(1))
          {
              yourOnMouseUpFunction();
              dragging = false;
          }
  
          if (dragging)
          {
              yourOnMouseDragFunction();
          }
      }
  }
  </code></pre>