Topic: Convert DrawingPoly to Mesh ...or Marker?

Currently when I create a DrawingPoly and add it to the map, it is not a selectable mesh object.

Is there a way I can convert it, maybe to a marker, or some kind of game object that can be selected after creation?

Re: Convert DrawingPoly to Mesh ...or Marker?

Hello.

If you are using a Tileset, each drawing element is a separate GameObject that you can add a Collider to and interact with.
Or each drawing element has events that you can use.
https://infinity-code.com/doxygen/onlin … 7c3bd5d9b1

Yes, you can use something else instead of the Drawing API, including markers or manual positioning of GameObjects.
But in this case, you will need to implement the drawing yourself.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 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.

Re: Convert DrawingPoly to Mesh ...or Marker?

So I'm drawing it on a 2D map, which isnt a Tileset, is there a way to do that?  Or do I need to just switch to 3d and go with Tileset?

Re: Convert DrawingPoly to Mesh ...or Marker?

You can use Drawing Element events with any control.
If you want to get a GameObject, this is only possible with Tileset.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 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.

Re: Convert DrawingPoly to Mesh ...or Marker?

Ok thanks Alex!

6 (edited by mcb 2021-09-15 18:03:56)

Re: Convert DrawingPoly to Mesh ...or Marker?

Ok Alex, one last thing, I switched over to Tileset and I see now that my DrawingPolys are in fact game objects in the scene, however:

I am not seeing how I can apply any components to the drawing element

When I try to apply it this way:

 myDrawingElement.instance.gameobject.AddComponent<BoxCollider>()

the instance is always null--note I am trying to assign the collider right after it is added to the map....so it should be there right?

Is there another way I should be approaching this?

Currently I'm getting around it by going into the source code and adding the collider when the mesh filter and renderer are added, and then once the mesh is updated with the vertices, I update the collider's size and center.

It would be nice to do this without having to dive into your code.

I'm sure I'm missing something