void OnEnable() { path = GetComponent <OpenPath>(); particle_system = GetComponent <ParticleSystem>(); ParticleSystem.EmissionModule em = particle_system.emission; em.enabled = false; particle_array = new ParticleSystem.Particle[particle_system.maxParticles]; particle_trackerArray = new PathParticleTracker[particle_system.maxParticles]; for (int i = 0; i < particle_trackerArray.Length; i++) { particle_trackerArray[i] = new PathParticleTracker(); } emissionRateTracker = 1.0f / emissionRate; #if UNITY_EDITOR if (!Application.isPlaying) { editorTimetracker = EditorApplication.timeSinceStartup; } #endif }
// Use this for initialization void Start() { OpenPath path = GetComponent <OpenPath>(); pathPoints = new Vector3[path.Waypoints.Length]; for (int i = 0; i < path.Waypoints.Length; i++) { pathPoints[i] = path.Waypoints[i].position; } }
void OnEnable() { path = GetComponent<OpenPath>(); particle_system = GetComponent<ParticleSystem>(); ParticleSystem.EmissionModule em = particle_system.emission; em.enabled = false; particle_array = new ParticleSystem.Particle[particle_system.maxParticles]; particle_trackerArray = new PathParticleTracker[particle_system.maxParticles]; for(int i=0; i<particle_trackerArray.Length; i++) particle_trackerArray[i] = new PathParticleTracker(); emissionRateTracker = 1.0f/emissionRate; #if UNITY_EDITOR if(!Application.isPlaying){ editorTimetracker = EditorApplication.timeSinceStartup; } #endif }