Sprites
Use a list of sprites to construct a sequence of animation frames.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Field
- Namespace: UnityEngine
- Assembly: UnityEngine.ParticleSystemModule
Sprites = 1
Remarks
Defines the sprites that are added to Texture Sheet Animation.
Additional Resources: ParticleSystemAnimationMode.Grid
Examples
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.[RequireComponent(typeof(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); }}