Skip to content
This repository was archived by the owner on Dec 24, 2020. It is now read-only.

Commit 5cf182f

Browse files
committed
Fix generating ids for the model entries (was crashing when model has more than 300 meshes)
1 parent 161f994 commit 5cf182f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

FlaxEditor/SceneGraph/Actors/ModelActorNode.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,14 @@ private void BuildNodes(ModelActor actor)
7979

8080
var id = ID;
8181
var idBytes = id.ToByteArray();
82+
var counter = idBytes[3] << 24 + idBytes[2] << 16 + idBytes[1] << 8 + idBytes[0];
8283
for (int i = 0; i < entries.Length; i++)
8384
{
84-
idBytes[0] += 1;
85+
counter++;
86+
idBytes[0] = (byte)(counter & 0xff);
87+
idBytes[1] = (byte)(counter >> 8 & 0xff);
88+
idBytes[2] = (byte)(counter >> 16 & 0xff);
89+
idBytes[3] = (byte)(counter >> 24 & 0xff);
8590
AddChildNode(new EntryNode(this, new Guid(idBytes), i));
8691
}
8792
}

0 commit comments

Comments
 (0)