1 (edited by DDQ 2021-07-14 14:40:28)

Topic: OnlineMapsMarkerBase.SetPosition only updates when dragging map

Hi,

I am not completely sure if this is a bug but I almost assume. I want to position a 2D marker below cursor position:

    void TestSelector()
    {
        OnlineMapsMarker newMarker = UIMarkerController.Create(new Vector2(0f, 0f), MarkerTexture);
        Selector = newMarker;
    }

    void Update()
    {
        if (Map.control.GetCoords() != null && Selector != null)
        {
            Selector.SetPosition(Map.control.GetCoords().x, Map.control.GetCoords().y);
        }
    }

The code above does only position the marker as long as I press or hold the mouse button. If I move the cursor around without clicking, the marker doesnt change position.

Re: OnlineMapsMarkerBase.SetPosition only updates when dragging map

Hello.

You need to call redrawing of the map after updating the marker position.
https://infinity-code.com/doxygen/onlin … 199d39b885

P.S. Store the result of GetCoords in a variable for later reuse.
This will help you avoid unnecessary performance degradation.

Kind Regards,
Infinity Code Team.

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