1 (edited by moonflow123 2022-06-08 07:30:26)

Topic: Is there an instance to OnlineMapsDrawingElement?

Hi, I wanted to ask about OnlineMapsDrawingElement, whenever we draw something be it Polygon, Line, or Rect, is there a method to get the instance of the drawing?

For example of what I'm gonna do to the instance is, if I wanted to edit the drawings position or scale. And also, if I wanted to know the points of the polygon if I clicked it.

Re: Is there an instance to OnlineMapsDrawingElement?

Hello.

If you want to get GameObject on which some element is drawn:

GameObject instance = element.instance;

If you want to get an instance of the clicked element, then it is passed to the OnClick event.
https://infinity-code.com/doxygen/onlin … 7c3bd5d9b1

To get the points, cast it to its original type, and get/set the required value:

line.OnClick += OnLineClick;

private void OnLineClick(OnlineMapsDrawingElement element)
{
    OnlineMapsDrawingLine line = element as OnlineMapsDrawingLine;
    List<Vector2> points = line.points as List<Vector2>; // Here you need to use the type that was used when creating the line.
    Debug.Log(points.Count);
}
Kind Regards,
Infinity Code Team.

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

3 (edited by moonflow123 2022-06-09 02:53:20)

Re: Is there an instance to OnlineMapsDrawingElement?

Is there a chance I can move or scale the element without having to draw it again?

Re: Is there an instance to OnlineMapsDrawingElement?

Using Drawing API - no, it was not designed to be used that way.
But you can use some other drawing methods like LineRenderer, GL or third party drawing assets.

Kind Regards,
Infinity Code Team.

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

Re: Is there an instance to OnlineMapsDrawingElement?

Ok, one more question. Is there a way to stop the map from moving without using OnlineMaps.blockAllInteraction?

6 (edited by moonflow123 2022-06-10 03:52:21)

Re: Is there an instance to OnlineMapsDrawingElement?

Nevermind, I got it. I used this

OnlineMaps.instance.GetComponent<OnlineMapsTileSetControl>().allowUserControl = false;