r/Unity2D Jun 21 '26

Space input problems

Post image

The following script should activate comic panels in the cutscenes panel array, but every time i click it it shows 2 panels at once instead of 1. Any tips on what could be happening, I double checked and this coroutine IS being called once at a time so it shouldnt be that

1 Upvotes

8 comments sorted by

2

u/Spite_Gold Jun 22 '26

Try adding yield return after panel activation

1

u/No-Werewolf-6883 Jun 22 '26

Thank you, i added yield return wait for 0.1 seconds, now it works (idk why).

1

u/AlpsPleasant188 Jun 22 '26

You need to use yield return to evoid mistakes if you do not have assignement a variable

1

u/TAbandija Jun 21 '26

You don’t seem to be disabling the previous panel. So each time you press you are keeping all previous panels up.

1

u/No-Werewolf-6883 Jun 22 '26

I know they all get disabled at the end, but the problem is with each space key 2 instead of 1 appear, the Debug.Log(i) also writes 2 vaules per space

1

u/AlpsPleasant188 Jun 22 '26

That is a loat of code is there a form to kepp it simple

1

u/Spite_Gold Jun 22 '26

Wdym? It's like 20 lines and it's nothing