- Home /
Is there a way to force the web player to the background?
I have a Facebook canvas page hosting a Unity web player game. The problem is that the Unity player draws over top of everything else, so if for example the user has notifications they can only see part of the drop down menu from Facebook. Likewise if I attempt a wall post, the dialog from Facebook gets drawn behind the Unity window.
I'm almost certain I've seen a solution to this before but my Google-Fu appears to be broken tonight.
Answer by burnumd · Nov 01, 2010 at 02:40 PM
No other elements can draw on top of a Unity web player within the browser. The standard workaround is to temporarily hide the div that contains your Unity content, resize it to zero pixels, or use one of the above techniques in conjunction with a static splash image replacing your Unity content, all of which can be done using Javascript on the containing page.
hrm, hiding the div triggers Unity to start the app over when it gets shown again which is what triggered this question. I'll try just resizing it down.
I was using Prototype "$('unityPlayer').hide". Resizing worked like a charm, now I just need to animate the resize so it's not so jarring.
I'm not sure how Prototype works, but I believe that in the past, setting the visibility property of the div worked for me, with the added benefit that it holds that space, in case you have a footer you don't want to move.
Answer by gorbi_one · Feb 07, 2013 at 02:01 PM
Hi there, Im having trouble to show/hide the unity div. If I only switch style.visibility from hidden to visible on the unityPlayer div, IE automatically reload the unityPlayer, which is off course not the behaviour expected. Works fine with FF. Could you show a bit of code to resize the div pls ? Or the way you use $('unityPlayer').hide ? Thanks a lot ! Stef.
This question has already been asked and answered. You need to open a new question.
The workaround for this is to use "style.visibility" ins$$anonymous$$d of "style.display"
document.getElementById("unityPlayer").style.visibility="hidden";