I have a ScriptableObject
, saved as a .asset
, and I want it to contains an array of generated meshes.
public class myObject : ScriptableObject
{
[SerializeField] Mesh[] myMeshes;
void Construct ( int count )
{
myMeshes = new Mesh[count];
for( int i=0 ; i<count ; i++ )
{
myMeshes = new Mesh();
// Filling the mesh with vertices and triangles
}
}
}
I want my meshes to be saved, but I will have hundreds of .asset
, and if I save them externally, I will have tens thousand meshes and as much files.
→ Is there a way to save the meshes inside my ScriptableObject
’s .asset
file, so they are saved/loaded properly when opening/closing Unity?
Shouldn't this work right out of the box? Did you tried to make the array public? Though [SerializeField] should have the same effect...
– HammerfestWell this don't seems to work. When trying to reach the meshes, all I got is an array of null references.
– Crevice