I am making a game where there are 4 “shields” that protect a sphere. (first game, didn’t want to do anything very challenging).
Here is my code
void Update () {
if (Input.GetKeyDown (KeyCode.S))
gameObject.SetActive(true);
if (Input.GetKeyDown (KeyCode.A))
gameObject.SetActive(false);
if (Input.GetKeyDown (KeyCode.D))
gameObject.SetActive(false);
if (Input.GetKeyDown (KeyCode.W))
gameObject.SetActive(false);
}
the post separated my text.
This is copy and pasted to my other 3 “shields” with the correct keys changed to match.
When I press a button, the others disappear like they’re supposed to, but when I press another button, the remaining one disappears, but the other one doesn’t show up.
I’ve been working on this for a while and can’t find a solution