diff --git a/spine-csharp/src/Attachments/VertexAttachment.cs b/spine-csharp/src/Attachments/VertexAttachment.cs index a7efaeb3d..4add2954b 100644 --- a/spine-csharp/src/Attachments/VertexAttachment.cs +++ b/spine-csharp/src/Attachments/VertexAttachment.cs @@ -34,8 +34,17 @@ namespace Spine { /// >An attachment with vertices that are transformed by one or more bones and can be deformed by a slot's vertices. public class VertexAttachment : Attachment { static int nextID = 0; + static Object nextIdLock = new Object(); + static int GetNextID () { + int returnValue; + lock (nextIdLock) { + returnValue = nextID; + nextID++; + } + return returnValue; + } - internal readonly int id = (nextID++ & 65535) << 11; + internal readonly int id = (VertexAttachment.GetNextID() & 65535) << 11; internal int[] bones; internal float[] vertices; internal int worldVerticesLength;