thrusters = GameObject.FindGameObjectsWithTag("Thruster");
for (var thruster in thrusters) {
var e = thruster.AddComponent("MeshParticleEmitter");
var a = thruster.AddComponent("ParticleAnimator");
var r = thruster.AddComponent("ParticleRenderer");
a.sizeGrow = 1;
e.InterpolateTriangles = true; !!
e.SimulateInWorldSpace = false; !!
e.localVelocity.x = -.2;
var arr = new Array(Resources.Load("Materials/Fire1"));
r.materials = arr.ToBuiltin(Material);
}
But, as you can porobably see, my references to the Simulate in world space and interpolate triangles options aren’t valid. Can these be referenced programmatically?
Unfortunately not all properties are exposed to scripting. Instead of adding components, you can make a prefab set up the way you want and instantiate that.
Yep, you can do that. The mesh emitter is kinda strange in that you reference the mesh from a MeshFilter component, rather than the ParticleEmitter component. In other words, changing the mesh in MeshFilter changes the mesh in the mesh particle emitter. (Which is good because you can’t access the mesh in the mesh particle emitter.)