AddSprite(Sprite)
Add a new Sprite.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.ParticleSystemModule
public void AddSprite(Sprite sprite)
Parameters
The Sprite to be added.
Remarks
Additional Resources: ParticleSystem.TextureSheetAnimationModule.RemoveSprite.
Examples
using UnityEngine;using System.Collections;[RequireComponent(typeof(ParticleSystem))]public class ExampleClass : MonoBehaviour{ private ParticleSystem ps; private Sprite sprite; void Start() { ps = GetComponent<ParticleSystem>(); sprite = Sprite.Create(Texture2D.whiteTexture, new Rect(0, 0, 1, 1), Vector2.zero); var textureSheetAnimation = ps.textureSheetAnimation; textureSheetAnimation.enabled = true; textureSheetAnimation.mode = ParticleSystemAnimationMode.Sprites; textureSheetAnimation.AddSprite(sprite); }}