Unity 4.3, generate 2d mesh

Hello everyone.

For a top down 2D simulation I’m trying to create characters with a displayed FOV cone.
I’ve thought up the math and everything, but the problem I’m facing is implementing this in the 2D mode.

It would be great to create a filled version of the meshCollider2d as a meshfilter2d (which doesn’t exist).
I have 2 reasons for wanting to do this in the 2D mode:

  1. I want to use 2D line casting against 2D colliders on sprites.
  2. I want to display the dynamic FOV in between the floor and whatever is above it as a semi-transparent overlay.

I’ve been googling for over an hour trying to find a matching solution, but nothing turns up for the new 2D mode.

Is this possible or is this outside the bounds of what the 2d mode made for?

All of this is rendered down to opengl so unless they are creating 3d meshes either way. So unity is doing some more advanced stuff under the hood to handle the depth. If you want to interlace 3d and 2d you need to set all the sprite depth’s to zero and use z-position for depth instead. This doesn’t effect collision because 2D collision ignores z-position. Second question: yes you can use any of the 2d colliders with a 3d mesh renderer.

Thanks for the information Adamcbrz.
I did find another way to fix the depth issue.
A youtube video on unity 2d displayed a sprite based game with a 3d mechanical arm/crane on the background with a parallax background behind that, so I did decide to google some more, found this after another few hours:
http://forum.unity3d.com/threads/212006-Drawing-order-of-Meshes-and-Sprites

In short, all I needed to do was place this in the Start() function

renderer.sortingOrder = 1;

I did encounter a problem when updating the MeshFilter and the PolygonCollider2D in the same run (Tried in both Update and FixedUpdate). The MeshRenderer started to flicker. Disabling the PolygonCollider2D by unchecking it fixed the flickering.
Ps, I noticed the PolygonCollider2D flickering in the scene view.

Am I right to assume then that the PolygonCollider2D and the MeshRenderer don’t mix?

I used the following at the end of my MeshFilter update:

GetComponent(MeshFilter).mesh = mesh;

And at the end of my PolygonCollider2D update:

var polyColl2D : PolygonCollider2D = gameObject.GetComponent("PolygonCollider2D");
polyColl2D.SetPath(0, points);