Question by
BennIBol · Jul 05, 2020 at 06:04 AM ·
particlesgetkeydowngetkey
Invisible particle system bug
Hi, I am making a cloud that starts to rain when you press the spacebar. Currently, if I use "GetKey", the collider objects work as intended, but the particle system that represents the rain cannot be seen. The opposite happens if I include "GetKeyDown" instead. The rain particles show, but the invisible projectiles do not spawn as planned.
if (Input.GetKey(KeyCode.Space))
{
rain.Play();
if (timer)
{
timer = false;
Invoke("ProjectileSpawn", 1f);
}
}
if (Input.GetKeyUp(KeyCode.Space))
{
rain.Stop();
}
}
void ProjectileSpawn()
{
if (Input.GetKey(KeyCode.Space))
{
Instantiate(projectile, this.transform.position, projectile.transform.rotation);
}
timer = true;
}r code here
Comment
Your answer
Follow this Question
Related Questions
Regularly rotation control with keys,Regularly Rotation control by keys 0 Answers
What is the difference between Getkey and Getkeydown (C#) 1 Answer
GetKeyDown breaks jumping vs GetKey 1 Answer
How can I simulate the smoothness of the Input.GetAxis? 0 Answers
GetKeyDown Not Functioning When Two Unrelated GetKeys are True 0 Answers