Hi everyone, I have a camera orbit around a object, that camera has a the canvas/UI in which I have a slider to control the volume. Problem is that when I drag the slider, the camera also moves. I´m not a programmer but I´m trying my best to get something done, and not far from doing it. Should be something simple, but out of my knowledge. Can anyone help me?
Thanks
Goncalo-Sousa, you can accomplish what you are trying to do using the Unity event system. Create a script with the following in it. Attach this to your slider and when the pointer enters the UI rect it will trigger the OnPointerEnter function. When the pointer leaves the OnPointerExit will be called. use these functions to enable and disable the camera movement.
using UnityEngine;
using UnityEngine.EventSystems;
public class SliderControl : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
public void OnPointerEnter(PointerEventData eventData)
{
Debug.Log("on enter");
}
public void OnPointerExit(PointerEventData eventData)
{
Debug.Log("on exit");
}
Thanks guys! That should help.