Created
October 21, 2018 15:54
-
-
Save kaiware007/1a1a8235d589fa07ac6ffed1c125d22d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class SimpleParticlePlayer : MonoBehaviour { | |
/// <summary> | |
/// パーティクルシステムへの参照 | |
/// </summary> | |
[SerializeField] | |
ParticleSystem particleSystem; | |
/// <summary> | |
/// パーティクルを再生するキー | |
/// </summary> | |
[SerializeField] | |
KeyCode playKey = KeyCode.M; | |
/// <summary> | |
/// パーティクル再生前に前のパーティクルを消去するか? | |
/// </summary> | |
[SerializeField] | |
bool isPlayWithClear = false; | |
// Update is called once per frame | |
void Update () { | |
if (Input.GetKeyDown(playKey)) | |
{ | |
if (isPlayWithClear) | |
{ | |
particleSystem.Stop(); | |
particleSystem.Clear(); | |
} | |
particleSystem.Play(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment