1 (edited by Rob66 2021-05-17 18:11:49)

Topic: Significant Continuous Performance Hit On Android?

OnlineMapsControlBase.Update is currently profiling at around 28% of a frame without any user interaction.

I just thought I'd ask if there's an 'offical' way of getting it to go to sleep when it's idle before I start hacking away.

Of course, I'm not completely oblivious to the idea that I might just be doing something stupid. smile

Version is 3.7.6.2 and host is Unity 2020.1.13f1

Many thanks.

Rob.

Edit -

Should this also include Android ?

/// <summary>
    /// Updates the map zoom for mouse wheel.
    /// </summary>
    protected void UpdateZoom()
    {
#if UNITY_IOS && !UNITY_EDITOR
        return;
#endif

2 (edited by Rob66 2021-05-17 18:53:17)

Re: Significant Continuous Performance Hit On Android?

Also - Should we really be Raycasting every frame for Tool Tips on touch devices?

HitTest() calls EventSystem.RaycastAll() which is VERY expensive.

############

protected void Update()
    {
        if (OnUpdateBefore != null) OnUpdateBefore();

        BeforeUpdate();
        _screenRect = GetRect();

        int touchCount = GetTouchCount();

        if (touchCount != lastTouchCount)
        {
            if (allowTouchZoom)
            {
                if (touchCount == 1) OnMapBasePress();
                else if (touchCount == 0) OnMapBaseRelease();
            }

            if (lastTouchCount == 0) UpdateLastPosition();
        }

        if (isMapDrag && !smoothZoomStarted) UpdatePosition();

        if (allowZoom)
        {
            UpdateZoom();
            UpdateGestureZoom(touchCount);
        }

        lastTouchCount = touchCount;

        if (dragMarker != null) DragMarker();
        else if (HitTest())
        {
            map.tooltipDrawer.ShowMarkersTooltip(GetInputPosition());
        }
        else
        {
            OnlineMapsTooltipDrawerBase.tooltip = string.Empty;
            OnlineMapsTooltipDrawerBase.tooltipMarker = null;
        }
        AfterUpdate();

        if (OnUpdateAfter != null) OnUpdateAfter();

        UpdateLastPosition();
    }

########

Re: Significant Continuous Performance Hit On Android?

Hello.

28% without interaction is a lot.
If possible, send me your project by email (support@infinity-code.com), I will check why this is happening.
To make it clear:
I don't need your working project.
I need any temporary project where the problem manifests itself.

A long time ago there was a directive for Android, but I don't remember why I removed it.
Most likely there was some problem with using the mouse on android devices.
I added this directive again and in the next version it will contain the directive for Android.

HitTest() calls EventSystem.RaycastAll() which is VERY expensive.

You are using UI Image Control or UI Raw Image Control, right?
Consider using a tileset. It's much faster and uses less memory.
Yes, a Raycast is needed here, but it is needed once, and the map can make several raycasts per frame.
Thanks for showing me this.
I will try to optimize this behavior.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 40 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.