I have a question is there a way how i can run a method at the same time as the update. Example in unity there is a function to start a coroutine is there something similar in playcanvas or javascript in general.
Thanks and sorry if it is a dumb but javascript is not my forte
Co-routines (Generators in javascript) arenât generally supported in most web browsers. So you canât do a Unity style co-routine.
On the whole, Javascript in the browser is single-threaded so in your game, you get a sequence of update function calls in order to make perform actions.
It is possible to run code in a separate âWorkerâ. See Web Workers, but they donât really fill the same niche as co-routines in Unity.
Coroutines in Unity do not run in parallel. They run until you yield and then another coroutine continues etc. So if by âsimultaneouslyâ you mean in the way Unity does coroutines then no there are no coroutines in PlayCanvas or Javascript at the moment. You can achieve the same result using regular functions and timers or callbacks.