[unity] Fixed too high Mesh vertex count when multiple submeshes are used (in combination with clipping). Supported on Unity 2019.3+. Closes #1894.

This commit is contained in:
Harald Csaszar 2021-05-20 19:26:21 +02:00
parent 844c614a8c
commit f0f52da3ad

View File

@ -27,6 +27,10 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ *****************************************************************************/
#if UNITY_2019_3_OR_NEWER
#define MESH_SET_TRIANGLES_PROVIDES_LENGTH_PARAM
#endif
// Not for optimization. Do not disable. // Not for optimization. Do not disable.
#define SPINE_TRIANGLECHECK // Avoid calling SetTriangles at the cost of checking for mesh differences (vertex counts, memberwise attachment list compare) every frame. #define SPINE_TRIANGLECHECK // Avoid calling SetTriangles at the cost of checking for mesh differences (vertex counts, memberwise attachment list compare) every frame.
//#define SPINE_DEBUG //#define SPINE_DEBUG
@ -1117,7 +1121,11 @@ namespace Spine.Unity {
mesh.subMeshCount = submeshCount; mesh.subMeshCount = submeshCount;
for (int i = 0; i < submeshCount; i++) for (int i = 0; i < submeshCount; i++)
#if MESH_SET_TRIANGLES_PROVIDES_LENGTH_PARAM
mesh.SetTriangles(submeshesItems[i].Items, 0, submeshesItems[i].Count, i, false);
#else
mesh.SetTriangles(submeshesItems[i].Items, i, false); mesh.SetTriangles(submeshesItems[i].Items, i, false);
#endif
} }
#endregion #endregion