Hi! After updating to SPINE 4.x+
, I've noticed a new issue appear revolving around Mesh data and how it's seemingly (?) saved into prefabs that contain instances of SkeletonAnimation
.
Our game has a complex prefab system for managing towns and other environments—each town has a number of NPCs, each NPC being its own prefab variant (of a baseline NPC) that has most of its settings saved to the prefab variant (exceptions being position in the town, etc., which are saved in the town prefab).
When saving an existing Town prefab, the file size of the prefab jumps 30-50x, from general sizes (SPINE 3.8
) of around 1-5 mb to 50-90 mb now. I wasn't sure what the problem was and didn't know why 1,500,000 lines were being added to the .prefab
file when checking the diff for prefabs on GitHub, but a few things tipped me to the idea that it may likely have to do with SPINE.
I'm finding that the Mesh
data's triangle, position, color, indices etc data are all being saved into the parent prefab (town), and this seems to be the cause of the prefab file size bloat. Within the Town prefab, I'm seeing millions of lines (relating to the NPC prefab based on the guid
) like these:
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1388]
value: 463
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1389]
value: 462
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1390]
value: 460
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1391]
value: 461
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1392]
value: 459
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1393]
value: 461
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1394]
value: 460
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1395]
value: 458
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1396]
value: 459
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1397]
value: 460
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1398]
value: 442
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1399]
value: 459
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1400]
value: 458
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1401]
value: 444
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1402]
value: 442
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1403]
value: 458
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1404]
value: 443
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1405]
value: 454
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1406]
value: 457
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1407]
value: 455
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1408]
value: 457
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1409]
value: 454
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1410]
value: 456
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
propertyPath: m_Triangles.Array.data[1411]
value: 455
objectReference: {fileID: 0}
- target: {fileID: 993508108996568647, guid: 59eecd1c5cc9e44bd99528cfa1581e21,
type: 3}
A look at the NPC prefab in question shows a new dropdown that I haven't seen before-I assume it's a new SPINE 4.x
addition or a new addition to Unity 2021 LTS
(was working via 2020 before).
A look at an example Town prefab that has jumped in size due to millions of new lines of seemingly redundant (?) data also is reflected with this strange dropdown. Each mesh applies a couple hundred thousands of lines of yaml data to the .prefab
file.
A look at the inspector when clicking one of the mesh data items in the dropdown shows this:
Is there a setting or option that I'm missing somewhere within the SPINE 4.x
setup? I've looked through the documentation and forum for potentially similar issues but have yet to find something similar to this one. I'm not sure if the +50-90mb bloat affects the gameplay performance that much (I haven't noticed major drops in play), but I can only assume that so many redundant lines being added to existing prefabs (only on save, by the way!) is probably not the intended behavior? If this is not a SPINE issue, please let me know! ??
Ah! I would also like to note that one of our larger towns went from a prefab size of 20 mb to 232 mb after trying to save the prefab with the existing SPINE that were present in the town. It also takes 1-2 minutes to save the prefab now, compared to the 5-10s that it took before. Any advice or things to try out would be greatly appreciated! ??