I would like to set up a web page with multiple Unity webplayers on it. At any one time I want only one webplayer to be active. As the user clicks on a different one I want the other webplayers to become paused. Clicking on a paused webplayer should resume exactly instantly where it left off, not reload from the start. I know you can run multiple webplayers simultaneously, I already tried it. I also know I can keep track of which players get the pause and unpause messages using javascript.
I’m just wondering how to get a webplayer to pause without sitting hogging the cpu/gpu resources? ie… a way to give big slices of time to the o/s with a very low-overhead loop that checks for an unpause message? I thought about maybe doing a yield WaitForSeconds(1); or similar, in a loop, then check for an unpause message, but will this still hog the cpu? At any one time I might like to have 2 or 3 webplayers running simultaneously on the page.
while (paused) do {
yield;
}
Just put this after the paused message comes up and it will make the function wait until you change that value.
I would highly recommend against multiple webplayers.
They are costly and running several of them at the same time will make weaker systems to crawl to a point where they will curse your page for granted
+1, I did this to test out my master server page and I needed to open 15(which I did eventually). It was crawling after 5 though.
Thanks for that, but what I need to know is how long the yield lasts for before the while loop tests the paused variable again… is it 1 frame? And while yield is yielding, does the o/s get its cpu time back?
As for running multiple plugins, I do agree you have a point not to run too many because even when doing a bare minimum of pausing they are gunna chew up resources especially on a slow machine. Bearing in mind the graphics won’t be doing anything and no scripts would be running - that’s why I’m trying to find out how to totally minimize resource use. I guess I’ll have to put together a test page and see how it goes.
I guess if I could get at least 2 running on a page that’d be good… planning to use one for and animated website header and maybe also some navigation.