I’m fixing errors and bugs that we encountered during testing.
Below is a list and an explanation of what I did:
Added code in Arduino – if buttons 1 and 3 are pressed, send ‘666’ signal to Unity.
Unity: in script “player” added that if it receives 666, let it move to Scene 0.

- Problems with the wrong set of sounds
I’ve changed the code in Arduino – now on pads, it sends signals only “0,7,14,21”.
0, 7, 14, 21 is for Scene 1
1, 8, 15, 22 is for Scene 2 and so on

And in Unity – depending on the scene, there are interpreted to individual sounds.
(z = x + SceneCounter – 2) <— play the sound from which equals the input from Arduino (eg 0) add a stage number to it minus 2 (Scene01 has SceneCounter = 2, to play the sound
0, 7, 14, 21 is -2; Scene02 has SceneCounter = 3, that’s why the game plays sounds 1, 8, 15, 22)
- Delete sounds button (already exists) – function to delete sounds immediately so we don’t have to wait for looping to end
It is in the “player” script (Unity) in two places (or actually 14, because we have 7 scenes).
PlayRecordOne … PLayRecordSeven has added features that check whether the list of recorded sounds is empty before playing the sound.
Likewise, in ResetRecordOne … Seven, a function has been added that checks before the list is cleared or is no longer empty.
Previously, this generated errors – or after reset it tried to play an element from the list that isn’t there or tried to clear the clean list – so it couldn’t be reset
- After 5 minutes when it is finished, you can play – error, because we shouldn’t play sounds when the final video is played
When Scene is “0” “Scene00” or “Scene08”, the pads don’t play.
This is done in this way:
In each of these scenes, there is a new object “GameObject0”, “GameObject00”, “GameObject08”, which in the “player” script I write the value of the scene to “0”.
Pads only work if SceneCounter> = 2, therefore they do not work at 0.
Exception – Scene08 Scene gives “SceneCounter” value to 69 (value selected randomly, out of already used)
This is for the 1 button not to load “Next Scene” only “Scene00” otherwise there is an error about the fact that there is no next scene

@izabelatyprowicz