Topic: Mouse Input Query

Hi,

As per my design requirement, I need to add
- right click to add the marker
- left click and drag to drag the map

i need to understand what will be the correct way to achieve this.
Thank you.

Re: Mouse Input Query

Hi.

An example of how to create markers using the right mouse button:

using UnityEngine;

public class CreateMarkerByRMB : MonoBehaviour
{
    private void Update()
    {
        if (!Input.GetMouseButtonDown(1)) return;
        
        double longitude, latitude;
        if (!OnlineMapsControlBase.instance.GetCoords(out longitude, out latitude)) return;
        OnlineMapsMarkerManager.CreateItem(longitude, latitude, "Marker");
    }
}

Moving the map using the left mouse button is a built-in behavior and you don't need to do anything for it.

Kind Regards,
Infinity Code Team.

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