1 (edited by vai-ma 2019-02-04 17:58:53)

Topic: Issue with RemoveByTag

In OnlineMapsMarkerManagerBase.cs, the RemoveByTag has

RemoveAll(m =>
        {
            for (int j = 0; j < tags.Length; j++) if (m.tags.Contains(tags[j])) return true;
            return false;
        });

In the "RemoveAll" method, the default for "dispose" is true, so it will go through the predicate sent from above and call Dispose on each element. The Dispose method for the map markers does

 tag = null 

This poses a problem in the next line of the RemoveAll method that does

 items.RemoveAll(match) 

this again calls the predicate, but this time "m.tags.Contains..." will throw a null error.

It seems more efficient to instead have the RemoveAll method be something like this ...

        List<U> matchingItems = items.FindAll(match);
        foreach (U item in matchingItems)
        {
            items.Remove(item);
            if(dispose)
            {
                item.Dispose();
            }
        }

        Redraw();

We heavily use tags and this is killing our port to v3!
Thanks!
-m

Re: Issue with RemoveByTag

Hello.

Thank you for the bug report.
The problem has been fixed.
In the next version this will work correctly.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!