add particle systems
add vfx graph
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayParticleSystem : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private ParticleSystem _particleSystem;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// useless, use OnValidate or Reset instead
|
||||
ParticleSystem.MainModule main = _particleSystem.main;
|
||||
main.playOnAwake = false;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetButtonDown("Fire1"))
|
||||
{
|
||||
_particleSystem.Play();
|
||||
}
|
||||
|
||||
if (Input.GetButtonDown("Fire2"))
|
||||
{
|
||||
_particleSystem.Emit(100);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
if (_particleSystem)
|
||||
{
|
||||
ParticleSystem.MainModule main = _particleSystem.main;
|
||||
main.playOnAwake = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7a0a7523465641399991692ba7fcddd
|
||||
Reference in New Issue
Block a user