nrush
1
Hi,
i need to play a particle effect on button press, this is my code:
public class moreController : MonoBehaviour {
ParticleSystem myParticles;
void Update ()
{
if(Input.GetButtonDown("r")) {
myParticles.Play();
}
}
}
but on press particle effect doesn’t start
(input r is assigned in project setting)
can you help me??
1.Create a particle effect
2.Make it as a prefab
3.Use a empty gameobject as spawnpoint for the particle effect
4.Use the following code
public class moreController : MonoBehaviour {
public GameObject myParticles; // drag and drop the particle effect prefab here on the
editor
public GameObject spawnpoint; //drag and drop the empty gameobject here on the editor
void Update ()
{
if(Input.GetButtonDown(“r”))
{
Instantiate(myParticles,spawnpoint.position,Quaternion.identity);
}
}
}