ParticleSystem 変数 =《GameObject》.GetComponent<ParticleSystem>();GameObjectインスタンスの「GetComponent」メソッドを使い、ParticleSystemインスタンスを取り出します。後は、このインスタンスからメソッドを呼び出すだけです。
《ParticleSystem》.Play();
《ParticleSystem》.Stop();
※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
using UnityEngine; using System.Collections; public class MyObj : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (Input.GetMouseButtonDown(0)){ GameObject obj = GameObject.Find("Particle System"); ParticleSystem particle = obj.GetComponent<ParticleSystem>(); particle.Play(); } if (Input.GetMouseButtonUp(0)){ GameObject obj = GameObject.Find("Particle System"); ParticleSystem particle = obj.GetComponent<ParticleSystem>(); particle.Stop(); } } }
<< 前へ | 次へ >> |