mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[unity] Fixed compile error on older Unity versions of RenderCombinedMesh. See commit ed75bff.
This commit is contained in:
parent
ee3486ce5a
commit
defa80c78d
@ -31,6 +31,10 @@
|
|||||||
#define NEW_PREFAB_SYSTEM
|
#define NEW_PREFAB_SYSTEM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if UNITY_2019_3_OR_NEWER
|
||||||
|
#define SET_VERTICES_HAS_LENGTH_PARAMETER
|
||||||
|
#endif
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -230,10 +234,26 @@ namespace Spine.Unity.Examples {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mesh combinedMesh = doubleBufferedMesh.GetNext();
|
Mesh combinedMesh = doubleBufferedMesh.GetNext();
|
||||||
|
#if SET_VERTICES_HAS_LENGTH_PARAMETER
|
||||||
combinedMesh.SetVertices(this.positionBuffer.Items, 0, this.positionBuffer.Count);
|
combinedMesh.SetVertices(this.positionBuffer.Items, 0, this.positionBuffer.Count);
|
||||||
combinedMesh.SetUVs(0, this.uvBuffer.Items, 0, this.uvBuffer.Count);
|
combinedMesh.SetUVs(0, this.uvBuffer.Items, 0, this.uvBuffer.Count);
|
||||||
combinedMesh.SetColors(this.colorBuffer.Items, 0, this.colorBuffer.Count);
|
combinedMesh.SetColors(this.colorBuffer.Items, 0, this.colorBuffer.Count);
|
||||||
combinedMesh.SetTriangles(this.indexBuffer.Items, 0, this.indexBuffer.Count, 0);
|
combinedMesh.SetTriangles(this.indexBuffer.Items, 0, this.indexBuffer.Count, 0);
|
||||||
|
#else
|
||||||
|
// fill excess with zero positions
|
||||||
|
{
|
||||||
|
int listCount = this.positionBuffer.Count;
|
||||||
|
Vector3[] positionArray = this.positionBuffer.Items;
|
||||||
|
int arrayLength = positionArray.Length;
|
||||||
|
Vector3 vector3zero = Vector3.zero;
|
||||||
|
for (int i = listCount; i < arrayLength; i++)
|
||||||
|
positionArray[i] = vector3zero;
|
||||||
|
}
|
||||||
|
combinedMesh.vertices = this.positionBuffer.Items;
|
||||||
|
combinedMesh.uv = this.uvBuffer.Items;
|
||||||
|
combinedMesh.colors32 = this.colorBuffer.Items;
|
||||||
|
combinedMesh.triangles = this.indexBuffer.Items;
|
||||||
|
#endif
|
||||||
ownMeshFilter.sharedMesh = combinedMesh;
|
ownMeshFilter.sharedMesh = combinedMesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user