Kulestar / powerui

PowerUI, the HTML UI framework for Unity.
139 stars 33 forks source link

UWP js setTimeout / setInterval #13

Open philfleck opened 6 years ago

philfleck commented 6 years ago

Hi again,

i discovered some strange issue:

when running

setTimeout(MyFunc, 1000);
var idIntv_MyFunc = setInterval(MyFunc, 30000);

as an standard win-app it works perfectly, BUT when switching to UWP MyFunc gets never called.

any suggestions or help?

Thanks in advance. -best

LukeBriggs4Roads commented 6 years ago

Hmm I do recall timers on UWP being awkward to implement - I believe they run via the Unity update loop as there were no other timer options available. setTimeout and setInterval are internally just using the UITimer class which has that update loop for WP8/ Metro. I would start by looking around in UITimer, but it may just be a case of that update loop not firing :)

philfleck commented 6 years ago

Thx for the hint, i will check it - a workaround i did for now was to implement a C# function using Coroutines and calling back into the js layer