so I have a custom mesh that I have generated using script and I want to assign it in a particle system but nothing will work. The first part of my code is where I delcare a public Mesh in my script just so I can assign the mesh there when I generate it and then take it from there to assign it to the particle system.
public Mesh Mesh;
[...]
Mesh = generated_mesh;
[...]
var shape = ps.shape;
shape.enabled = true;
shape.shapeType = ParticleSystemShapeType.MeshRenderer;
shape.mesh = Mesh;
The type changed to Mesh Renderer but the Mesh itself doesn't change.
Okay so it seems I was doing it the wrong way all along. I changed the shape type from mesh renderer to mesh and it's all good now. The confusing part is that when I was testing the particle system the only way I could assign the mesh to it manually was through the shape called mesh renderer and not the simple mesh. Anyway, it's all good now.
var shape = ps.shape;
shape.enabled = true;
shape.shapeType = ParticleSystemShapeType.Mesh;
shape.mesh = Mesh;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.