Goodmorning,
I am trying to write a script that can allow changes in the virtual environment only if Unity detects a certain range of data for a certain number of seconds from the Bitalino. So I need Unity to detect a range of variables from the bitalino and if I stay in this condition for 6 seconds there will be animations, but if it starts detecting another interval it has to check it again for 6 seconds before starting the other animations.
I wrote a script where a timer starts when the Bitalino starts reading the values, but it seems that when I reset the timer, Unity also resets my scene as when I enter into the play mode for the first time.
I would like to reset my timer only, otherwise I will lose my animations.
Would anyone know how to help me?
Thanks in advance!
.
i think you need to do something like
- loop packageOfData values (like you already do)
- detect if First stage condition is met, then start timer (could be coroutine, or set current timer = 0)
- then keep detecting values, and if First stage condition is still met and timer is over 6s, set aura active, OR, if First stage condition is not met, reset timer
and maybe some extra boolean, to say auraTimerStarted = true or so to keep track
Do you mean reset timer with time = 0.0f; ?
because it seems that this function reset all my scene to the first one, as I have just start the play mode, I don’t know how to reset just the timer.
Please don’t multipost, this is your 4th thread on this same question Detect a range of variables for 3 seconds