Question by 
               ChosenVan · Nov 04, 2018 at 08:57 AM · 
                rotationcanvasrotate objectrotatearound  
              
 
              How to rotate a UI element (button) ?
Hello.. Im new in unity (and maybe intermediate in C#)
I want to rotate this button when I press and hold it.
As you can see I put an arrow on it.
I want to turn it by pressing and holding (to a spesific direction)
Please help me. when I use transform.Rotate, its turning continuously.
I want to control direction with touchpress...
maybe a few line code but I couldnt write :(

 
                 
                screenn.png 
                (44.9 kB) 
               
 
              
               Comment
              
 
               
              Answer by ChosenVan · Nov 04, 2018 at 12:50 PM
I solved my problem. Thank you @Eugenius
https://answers.unity.com/questions/970470/unity5-rotate-ui-button-with-mousefinger.html your codes in this link helped me :)
I deleted unnecessary parts (unnecessary for me for now)
 public class ButtonRotate : MonoBehaviour {
 
     private float rotationSpeed = 10.0f;
 
     private Vector3 theSpeed;
     private Vector3 avgSpeed;
 
     public Transform myObj;
 
     void Update () 
     {
 
         if (Input.GetMouseButton(0)) 
         {
             theSpeed = new Vector3 (-Input.GetAxis ("Mouse X"), Input.GetAxis ("Mouse Y"));
             avgSpeed = Vector3.Lerp (avgSpeed, theSpeed, Time.deltaTime * 5);
         } else 
         {
             theSpeed = new Vector3 (0,0,0);
         }
 
         myObj = this.GetComponent<Transform> ();
         transform.Rotate (myObj.forward * theSpeed.x * rotationSpeed, Space.World);
     }
 }
 
              Your answer