sprite | The Sprite to be added. |
Add a new Sprite.
#pragma strict private var ps: ParticleSystem; private var sprite: Sprite; function Start() { ps = GetComponent.<ParticleSystem>(); sprite = Sprite.Create(Texture2D.whiteTexture, new Rect(0, 0, 1, 1), Vector2.zero); var textureSheetAnimation: var = ps.textureSheetAnimation; textureSheetAnimation.enabled = true; textureSheetAnimation.mode = ParticleSystemAnimationMode.Sprites; textureSheetAnimation.AddSprite(sprite); }
using UnityEngine; using System.Collections;
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); } }