Procedurally emit particles from verts on mesh.

I’m making something kind of weird. I need to make a script that will emit particles from a mesh’s verts and inherit their vert colors. The problem I’m running into is that the particles aren’t being born in the same shape as the object I’m emitting from. It ends up emitting in a odd disc shape. I want it to emit exactly on the points of a mesh. I tested this with a unity sphere.

Please can anyone try this out and tell me what’s wrong.

using UnityEngine;
using System.Collections;

public class MoveVerts : MonoBehaviour {
	void Update() {
		Mesh mesh = GetComponent<MeshFilter>().mesh;
		Vector3[] vertices = mesh.vertices;
		int i = 0;

		while (i < vertices.Length) {
			ParticleSystem.Particle _newParticle = new ParticleSystem.Particle();					
			_newParticle.position = transform.position + vertices*;*
  •  	_newParticle.lifetime = Mathf.Infinity;*
    
  •  	_newParticle.size = 1f;*
    
  •  	particleSystem.Emit(1);*
    
  •  	i++;*
    
  •  }*
    
  •  mesh.vertices = vertices;*
    
  •  mesh.RecalculateBounds();*
    
  • }*
    }

You are creating a particle instance and not using it. The correct approach for this is actually moving the entire system to each vertext and emiting a single particle there. Another thing to keep in mind is to cache the vertices before using a set so that you eliminate vertices that share position. You can use vertex normals to emit particles in the normal direction by orienting the system with the normal value. For vertices that share position, instead of just eliminating the extra copies (you would lose normal data), you can create a vertice in your set with the ‘mean’ normal with all shared normals.