SmartlyDressedGames / Unturned-3.x-Community

Community portion of the Unturned-3.x repo. If you have access to the source code you can find it here:
https://github.com/SmartlyDressedGames/Unturned-3.x/
83 stars 17 forks source link

The loop of TimerEventHook cannot be stopped #4407

Closed hyjhkt closed 1 month ago

hyjhkt commented 1 month ago

If TimerEventHook is checked and 'should replicate' is selected when other hooks call 'canceltimer', and if an object with TimerEventHook is deactivated and cannot stop timing

SDGNelson commented 1 month ago

Can you elaborate, please? TimerEventHook doesn't have an option to replicate.

hyjhkt commented 1 month ago

@SDGNelson If a component with TimerEventHook is disabled after selecting a loop, the timing of TimerEventHook will not be stopped. The canceltimer method cannot end the loop

SDGNelson commented 1 month ago

Are you sure? It only starts the next coroutine if gameObject.activeInHierarchy is true, so disabling should also stop it. I also double-checked by connecting TimerEventHook to ActivationEventHook.OnEnabled, and when disabling the gameObject the looping timer stopped.

SDGNelson commented 1 month ago

Closing but feel free to comment and I will re-open.