Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Unity Polygon Collider 2D to Mesh Collider Tool

Script to turn PolygonCollider2D into MeshColliders with depth · By AngelOnIt

Errors saving meshes

A topic by alexchouls created Sep 28, 2024 Views: 109 Replies: 4
Viewing posts 1 to 5
(+1)

Thanks for the tool, very handy!

I ran across a couple of errors when trying to save the generated mesh:

It can't save the mesh file until you create SavedMeshData folder (not in the package).

There is a HideFlags assertion and the saved mesh doesn't show as a Mesh. Fixed by adding m.hideFlags = HideFlags.None; to SaveMeshToFolder().

This was in Unity 2022.4.37f1.

Cheers,

Alex

Developer

Thanks for reporting these to me! and thanks for buying my plugin!

Regarding the errors:

1: [It can't save the mesh file until you create SavedMeshData folder (not in the package).]

-I added a check and a fix for the folder thing (Thanks for catching that!)

2: [the collider data does not save as a usable mesh]

-Although not intended in the initial release, this is a good idea and I've added your "m.hideFlags = HideFlags.None;" fix. Thanks! Now you can use the created mesh as regular meshes!

One more thing, when making a build you get an error because AssetDatabase is in the UnityEditor namespace.

Enclosing the contents of SaveMeshToFolder in #if UNITY_EDITOR   fixes it.

Developer

Makes sense! Thanks again!

Developer

Updated package is up :)