Topic: Right Click Function for Marker or Drawing??

Is there a right click function for marker or Drawing???

Re: Right Click Function for Marker or Drawing??

Hello.

Good question. I never thought about it.

Something like that:

using UnityEngine;

namespace InfinityCode.OnlineMapsSupport
{
    public class RightClickOnInteractiveElement : MonoBehaviour
    {
        private bool isRightPressed = false;
        private IOnlineMapsInteractiveElement pressedElement;

        private void OnRightClick(IOnlineMapsInteractiveElement element)
        {
            Debug.Log("OnRightClick");
        }

        private void OnRightPress(IOnlineMapsInteractiveElement element)
        {
            Debug.Log("OnRightPress");
        }

        private void OnRightRelease(IOnlineMapsInteractiveElement element)
        {
            Debug.Log("OnRightRelease");
        }

        private void Update()
        {
            bool rightPresses = Input.GetMouseButton(1);
            if (rightPresses == isRightPressed) return;

            isRightPressed = rightPresses;
            Vector2 inputPosition = OnlineMapsControlBase.instance.GetInputPosition();
            IOnlineMapsInteractiveElement element = OnlineMapsControlBase.instance.GetInteractiveElement(inputPosition);
            if (element == null) return;

            if (rightPresses)
            {
                pressedElement = element;
                OnRightPress(element);
            }
            else
            {
                OnRightRelease(element);
                if (pressedElement == element) OnRightClick(element);
                pressedElement = null;
            }
        }
    }
}
Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.