I can’t figure out what’s causing it or how to fix it. Something with my particle effects and Time.timeScale, I think?
(time >= 0.0f) && (time <= 1.0f)
UnityEditor.DockArea:OnGUI()
Assert in file: ./Runtime/Math/Gradient.h at line 108
I can’t figure out what’s causing it or how to fix it. Something with my particle effects and Time.timeScale, I think?
(time >= 0.0f) && (time <= 1.0f)
UnityEditor.DockArea:OnGUI()
Assert in file: ./Runtime/Math/Gradient.h at line 108
I have some helpful information. I do not get this error when I have the emitter going from the start. The only issue with this is I’m still not getting the ability to create ParticleSystem.Particle objects and place them where I want and see them. And further more, when I take all of the particles in the system, add a new one with hard coded values and touch none of the existing ones, and feed them all back to the ParticleSystem, it resets like I just asked it to Clear() and Play(). It’s almost like I somehow set their lifetimes back to 0.
Pretty annoying. This was working in the old system and as the link above has noted, they are including it in a future release (as of February they stated that and it’s not here yet as far as I can tell). I guess I’m going to have to pay $3k to batch my particles for new Unity 4 licenses for Pro and iOS if it’s even in there. In my opinion, if they have something working and it’s a fix of this nature, it should be in the point releases where that system was introduced.
Thanks for any clarity on this. I just can’t get it to work. Here’s my code.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class sprinkleParticleTest : MonoBehaviour {
public ParticleSystem pSys;
//place transforms in here in order to spawn particles from different locations
public List transList = new List();
// Use this for initialization
void Start () {
//Every 3 seconds we'll try to spawn a new particle on top of what's in the system
InvokeRepeating("EmitNewParticles", 0.0f, 3.0f);
}
void Awake()
{
pSys.enableEmission = true;
}
///
/// Emits new particles to the order of transList.Count in addition to already live ones
///
void EmitNewParticles()
{
if( transList.Count == 0 ) {
Debug.LogWarning("Put a Transform in this list... sucka!");
return;
}
ParticleSystem.Particle[] pList = new ParticleSystem.Particle[pSys.particleCount];
Debug.Log(pList.Length);
ParticleSystem.Particle[] outputList = new ParticleSystem.Particle[pList.Length+transList.Count];
int newParticlePlacedCount = 0;
for( int i=0; i <= pList.Length; i++) {
//create the one new particle
if( i > pList.Length - transList.Count ) {
ParticleSystem.Particle newParticle = CreateParticle(pList.Length - i);
outputList *= newParticle;*
++newParticlePlacedCount;
Debug.Log("newParticlePlacedCount == " + newParticlePlacedCount);
}
//or just use the existing ones, touching none of their properties and putting them back in the order I got them
else
outputList = pList*;*
}
//Set ParticleSystem.Particles back into the ParticleSystem
pSys.SetParticles(outputList, outputList.Length);
}
///
/// Create a new ParticleSystem.Particle object with mostly arbitrary values. Position is pulled from a List of available Transforms
///
///
/// The new particle.
///
private ParticleSystem.Particle CreateParticle(int transformPicker)
{
ParticleSystem.Particle newParticle = new ParticleSystem.Particle();
newParticle.position = transList[transformPicker].position;
newParticle.velocity = new Vector3( Random.Range(-0.3f,0.3f), Random.Range(-0.3f,0.3f), Random.Range(-0.3f,-0.3f));
newParticle.lifetime = Mathf.Min(0, pSys.startLifetime);
newParticle.startLifetime = pSys.startLifetime;
newParticle.size = 1.0f;
newParticle.rotation = 0.0f;
newParticle.angularVelocity = 1.0f;
return newParticle;
}
}