Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  Increasing file size for prefab variants [Softbody]
#1
Hi,

I've come to notice that the file size of a prefab variants with softbodies can get very large.
In our game we have some prefabs with softbodies that have around 350 particles. I was converting these to prefab variants when I found out that they went from around 1,125KB (Original prefab) to over 10,000KB (Prefab Variant).

Here's a little test case I put together with a simplified setup:

1. Create original prefab:
Just a GameObject with the following components:
  • Obi Softbody
  • Oki Shape Matching Constraints
  • Obi Pin Constraints components

A box with slightly rounded corners as the input mesh (42 verts).
Initialized with a Particle count of 8.
Particle generation settings = default

This prefab have a file size of 8KB.


2. Create a prefab variant from the prefab above and Initialize the softbody.
The variant file size is now 3KB.


3. Modify Particle generation settings on Obi Softbody and hit Initialize again.
Particle Generation settings
Particle Radius = 0.05
Particle Overlap = 0.75
Rest = default

Now the particle count is 24.
The variant file size is now 141KB.


4. Revert the variants Particle generation settings to same as Step 1.

Now the particle count is 8.
The variant file size is still 141KB.


The only way I can get back to 3KB is for me to create a new variant from the original prefab.
Am I doing something wrong or is this a bug?

Unity 2019.1.14f1
Obi Softbody 4.1
Reply
#2
(23-10-2019, 02:53 PM)JimItatake Wrote: Hi,

I've come to notice that the file size of a prefab variants with softbodies can get very large.
In our game we have some prefabs with softbodies that have around 350 particles. I was converting these to prefab variants when I found out that they went from around 1,125KB (Original prefab) to over 10,000KB (Prefab Variant).

Here's a little test case I put together with a simplified setup:

1. Create original prefab:
Just a GameObject with the following components:
  • Obi Softbody
  • Oki Shape Matching Constraints
  • Obi Pin Constraints components

A box with slightly rounded corners as the input mesh (42 verts).
Initialized with a Particle count of 8.
Particle generation settings = default

This prefab have a file size of 8KB.


2. Create a prefab variant from the prefab above and Initialize the softbody.
The variant file size is now 3KB.


3. Modify Particle generation settings on Obi Softbody and hit Initialize again.
Particle Generation settings
Particle Radius = 0.05
Particle Overlap = 0.75
Rest = default

Now the particle count is 24.
The variant file size is now 141KB.


4. Revert the variants Particle generation settings to same as Step 1.

Now the particle count is 8.
The variant file size is still 141KB.


The only way I can get back to 3KB is for me to create a new variant from the original prefab.
Am I doing something wrong or is this a bug?

Unity 2019.1.14f1
Obi Softbody 4.1

Hi,

Sadly for 4.x this is to be expected. Softbody components contain all particle/constraint data in serialized form. For large objects this can be quite a significant amount of data (more than a dozen arrays of per-particle data, as well as large index/parameter arrays for constraints.)

This is one of the main issues we've addressed in 5.0 (a few weeks away from release, currently in beta). All particle/constraint data is no longer serialized in the component itself, but in a separate asset. This means you can have as many instances (and prefab variants) of the same component, all sharing the same data.
Reply
#3
(23-10-2019, 08:59 PM)josemendez Wrote: Hi,

Sadly for 4.x this is to be expected. Softbody components contain all particle/constraint data in serialized form. For large objects this can be quite a significant amount of data (more than a dozen arrays of per-particle data, as well as large index/parameter arrays for constraints.)

This is one of the main issues we've addressed in 5.0 (a few weeks away from release, currently in beta). All particle/constraint data is no longer serialized in the component itself, but in a separate asset. This means you can have as many instances (and prefab variants) of the same component, all sharing the same data.

Thank you for your quick response,

It's very nice to hear that 5.0 is so close to release.

Just to clarify for myself, when I save a Original Prefab, the size of that file increases/decreases depending on particle count. But when I save a Prefab Variant, the size of that file only increases (a lot more than the Original Prefab) with particle count. It never decreases, even when I reduce the particle count. It's like old data never goes away.
Reply