I am currently using Texture Sheet Animation for my particle system, so when my bricks shatter, the particle system is shattered pieces of the brick. This works great for the brick destruction.
What I would like to do now is have a different particlesystem for collisions when bricks aren’t destroyed. For example, in the gif above when the bricks are hit for the first time, I get a particle system of the VHS cover exploding instead of the cassette itself. I haven’t been able to come up with a great way to link a specific particle system to the current appearance of the brick.
EDIT: I have actually since come up with a much better way to do this, though I’m not sure what the code for it is, exactly. I only need one particle system game object, and I need to set the Start Frame of the Texture Sheet Animation of the Particle System of the GameObject to times hit whenever I create an instance of it.
Since I’m doing this in Unity 5, I believe that would be
GetComponent<ParticleSystem>().textureSheetAnimation.startFrame
The only problem is when I do
debris.GetComponent<ParticleSystem>().textureSheetAnimation.startFrame = timesHit;
It tells me that “Cannot modify a value type return value of ‘UnityEngine.ParticleSystem.textureSheetAnimation’. Consider storing the value in a temporary variable”