Facebook wall post diolog z-fighting with unity player

hey guys, I just spent all day getting my head around facebooks API, and i managed to get my game not only running in facebook, but sending calls to the browser and running facebook API methods.

Needless to say, I was rather happy about that, until i found that when I call up a facebook feed form, to allow the user to post something on his or her wall, the form appears to be Z fighting with the unity3d web player. In fact, for the most part it loses, and spends all but a few quick flashes behind the player.

Anyone have an solution? is this because the webplayer is rendering every frame or something, and the facebook feed form isn’t? if that’s the case, is there a way to pause unity from updating for a sec?

I feel like i tripped 1 inch from the finish line. I could scream.

One idea is to use JavaScript and manipulate the CSS on-the-fly.

  1. Either have a DIV above the game and when you need to have the dialog box, increase the height of the DIV so the game gets pushed down.

  2. Hide the entire game using the visibility property of the DIV in which the game is located.

That’s a damn good idea. thanks Nick!

ah, heck, I can’t do this.

first of all, there’s no way that I can find to turn the visibility of the div back on when the user has posted or declined to post the message. furthermore, having the screen go white for a minute… iiiiiiiiiisssssss ugly.

anyone have a solution to this, or another idea?

What I did is check BEFORE going to the app if the user has the permission to post news and ask for it as I ran in the same issues as you.

ahh interesting. okay, let me give that a shot.

hey, things have been harry over the last 2 days and i haven’t been able to look into this until now.

I plugged in:

FB.Connect.showPermissionDialog(“publish_stream”);

Which, by the way, suggests the user that I’m going to be posting stuff to their wall without them knowing, which i really dont want to do… but anyway

It doesn’t work, because the dialog appears behind the unity window. go figure. were you implying (by “before”) that i make the unity appearing be dependant on them accepting?

am i on the right track, or were you referring to another api call?

this is a real pain in the ass.

http://apps.facebook.com/greenergrassgames/

this would be a very simple example of what i’m talking about.

okay, got it.

so the answer is basically that I can’t do this, because unity3d renders directly to screen, so any divs will be behind it.

Interesting. Okay, so i either post something to the user’s wall without notifying them, or I find a way to open up a form feed in a new window… which is probably impossible.

you must ask them at least once before you can post anyhting at all.
so its not like you are not asking.
You just can’t do it on a per case question

though I’m not sure if you could not just temporally resize the screen to 1x1 pixel for example

People told you what to do; just push down an existing div or something to make room for the popup.

I am trying to absolutely position a div behind a unity player and then on a click, have the player fade out, and have the div fade in. This works fine in theory but in practice the absolutely positioned div displaces the unity app down the page. What can I do?

	<body>
	  <div id="btnAnchor">
	  	<div id="superRewards">
				<input type="button" value="Click Me!" onClick="hideCreditWindow()">
	  		**DIV CONTENT**
			</div>
		</div>
		<div id="player">
			<script language="javascript1.1" type="text/javaScript">
				<!--
				**EMBED THE UNITY PLAYER
			// -->
			</script>
		</div>
	
	</body>
	
</html>
----------------css-------------------
body {
	background: #000 url(../images/background_logo_clean.jpg) no-repeat scroll top center;
	color: #ccc;
	text-align: center;
	overflow-x: hidden;
}
#btnAnchor{
	margin: 0 auto;
	height: 0px;
	width: 0px;
	position: relative;
	background-color: red;
}
#player{
	margin: 0 auto;
	text-align: center;
}
#superRewards{
	position: absolute;
	height: 0px;
	width: 0px;
	top: 200px;
	left: -174px;
	background: #E8F2FF;
	z-index:101;
	visibility: hidden;
}

It turns out the issue was that the .css wasn’t even loading due to a bug in the folder permissions.

That said, I’ll share a bit of my learnings:

If you are using JQUERY, DON’T try to do a ‘fadeOut’ and/or ‘fadeIn’ on the unity object. It doesn’t fade correctly and it causes the player to reload. Instead toggle the css {visibility: visible/hidden} to show/hide the player. Animating the opacity doesn’t do anything to a unity player object.