Question by
jgvidottora · Feb 24, 2017 at 03:38 PM ·
rotate objectscrolldrag objectshorizontal-sliderscroller
ScrollRect interferes with dragobject
I'm implementing a drag script on my gameobjects so the user can rotate them by touching the screen, I also have a horizontal scrollrect wich contains the buttons the user can choose to show the respective object, what is happening is when the user slide the finger to rotate the object the scrollrect is scrolling together, how can I prevent the scrollrect scroll when I rotate the object?
DragObject:
using UnityEngine;
using System.Collections;
public class DragObject : MonoBehaviour {
private float m_RotationSpeed = 40f;
void Start () {
}
void Update() {
if (1 == Input.touchCount) {
gameObject.transform.Rotate (Vector3.down, Input.touches [0].deltaPosition.x * m_RotationSpeed * Time.deltaTime);
}
}
}
ScrollRect:
35433-scrollrect-hierarchy.png
(5.0 kB)
35434-scrollrect-inspector.png
(73.7 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612111853im_/https://answers.unity.com/themes/thub/images/avi.jpg)