How can I solve my Mesh Particle Emitter problem?

I have been helped to find out that i can add an MPE with script

var pe : ParticleEmitter = wallChild.AddComponent("MeshParticleEmitter") as ParticleEmitter;

also I have learned that not all variables are exposed to scripting(I need Interpolate Triangles and the Normal Velocities). I am creating different shaped and sized meshes on the fly and want to add the MPE to the mesh. On the bright side, the settings I want from the MPE are always the same, just not the default settings. So can I do any of these things?

  1. Adjust the default settings of MPE when AddComponent is called, it would load the MPE with Interpolate Triangles ON and The Min and Max Normal Velocities to 1 - like the Unity MPE page suggests you set!

  2. I have an MPE on a gameobect in the game with the correct settings. Can I copy the MPE settings from the base mesh to my MPE settings on the created mesh?

  3. Have a prefab with the correct MPE in it and Instantiate it and add to the created mesh. I am trying to do this with little luck as shown.

    var flameFire : Transform = Instantiate(FloorScript.FlameStuff, childWall.position, 
       Quaternion.identity) as Transform;
    flameFire.parent = wall.transform.Find("Cube");
    
    

    but something is wrong the MPE doesn't take the shape of the mesh of "Cube".

Thank you.

  1. No, you can instantiate a prefab that has the settings you want.

  2. No, see 1.

  3. Assigning a parent won't do anything; you assign a mesh to a mesh particle emitter. But you have to do it indirectly by assigning the mesh to the attached MeshFilter component.

    GetComponent(MeshFilter).mesh = desiredMesh; // The ParticleEmitter component will use this mesh