Use a list of sprites to construct a sequence of animation frames.
Defines the sprites that are added to Texture Sheet Animation.
See Also: ParticleSystemAnimationMode.Grid
using UnityEngine;
// A particle sprite example. // The gameobject this script is attached to must have the // ParticleSystem attached. The TextureSheetAnimation mode // is set to Sprites. This script adds a single texture to // the ParticleSystem.
public class ExampleClass : MonoBehaviour { public Texture2D tex; private ParticleSystem ps; private Sprite sprite;
void Start() { ps = GetComponent<ParticleSystem>(); sprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), Vector2.zero);
var textureSheetAnimation = ps.textureSheetAnimation; textureSheetAnimation.enabled = true; textureSheetAnimation.mode = ParticleSystemAnimationMode.Sprites; textureSheetAnimation.AddSprite(sprite); } }
Did you find this page useful? Please give it a rating: