Unity / Facebook integration

I’ve been fighting with Facebook for the better part of a week now, and finally, I have it.

This demo shows a framework for integrating Unity3D with Facebook, with data exchange in both directions:

Please note that even though nothing visible happens, a story does get posted to your wall, so don’t click that button more than once. I tried going with dialogs, but they don’t work properly for iframe apps.

In a real app, of course, you’d not have a button, you’d post highscores or events, or whatever.

Posting title, text and image are fully configurable in the framework and can be different for each posting.

I hope Unity doesn’t mind that I use Lerps portrait for the story image.

thats awesome…a tut for this ?
please…or if u can attach the scripts ant the stuff that u did on facebook to make this work

This is very interesting, I would be interested in knowing how you went about this too if you are at liberty to discuss it that is.

Cheers and great work!

I’m curious to see this, unfortunately I get an error when I try to post a message:

message = is playing around
caption=Still working his way through the docs and wiki, {actor} is not yet giving up on the facebook API.
image_url=http://download.unity3d.com/support/resources/images/3d-platform-game-logo-small.png
image_link=http://unity3d.com
action_name=Visit Unity3D
action_link=http://unity3d.com

@Robert G:

I get the same thing, but if you check your wall, you’ll see it actually makes a post. Some kinks may have to be worked out, but it does seem this is a step in a very cool direction. Does everyone else see that error?

Tom, have you seen Tempest (Nick Breslin) topic/tutorial about Unity-Facebook integration?
Its great and helps you smooth out all the bumps there are on the road. He created an example project along with it.

Take a look his topic:
http://forum.unity3d.com/viewtopic.php?t=35974
His blog is also a great source of information for Facebook - Unity related stuff.

The need for extended permissions is really a setback, most people wont grant you them. (And they are right, since a lot of Facebook Apps spam continue to spam their users!)

Extended permissions could improve the usability, but make them optional. The user should be able to use your application without granting Extended Permissions.
One problem is that Facebook’s dialogs won’t show on top of Unity, to solve that you can temporary hide the Unity screen.

This bit of Javascript will hide and show the Unity window:

var OldSize = { 'width' : GetUnity().style.width,
				'height' : GetUnity().style.height };

function IsUnityHidden()
{
	return GetUnity().style.width != OldSize.width 
			GetUnity().style.height != OldSize.height;
}

function ToggleUnity()
{
	if(IsUnityHidden())
	{
		GetUnity().style.width = OldSize.width;
		GetUnity().style.height = OldSize.height;
	} else {
		GetUnity().style.width = 1;
		GetUnity().style.height = 1;
	}
}

Hello Tom,

Wow This is really awesome and exactly what Im looking for :slight_smile:

Is there anyway you can share the example code or the project files for how you did this? or possibly a tutorial on how you did this?

I was also noticing the that the lerpz publish or skip option is under the unity player but its seems Tijmen may have solved the problem :wink: Have you tried his little bit of code?

Sincerely,
Michael

Does anybody know where I can find samples/code/details on integrating facebook connect with my iphone app from within Unity iPhone?

Hmm, this might be what I’m looking for, although it’s for Unity (not Unity iPhone): http://unity3d.com/support/resources/unite-presentations/facebook-social-network-integration

is there a way to do that hide in Unity iPhone? GetUnity seems to only work in normal Unity.

this is for the webplayer and will not work on the iphone at all.

If you want to connect with Facebook in your iPhone apps then take a look at the Unity iPhone Enhancement Pack as it now exposes the Facebook iPhone APIs.

resurrection! (bwaaaa-uuRRRGg!!)

erm, before this post goes zombie, does anyone know if the facebook enhancements from that “iPhone Enhancement Pack” were built into Unity 3.0?

thanks!

Setting the height and width doesn’t seem to effect my plugin. Did this get disabled? Anyone know of another way to accomplish this?

Update: Firefox the pay dialogue displays just fine. Chrome(Rockmelt) it does not.

asseto to integrate Facebook and Unity web player: http://www.youtube.com/watch?v=Gvi8tFn8R_c&feature=youtu.be

A little game example using it: https://apps.facebook.com/rutasiervo/

Get it: Unity Asset Store - The Best Assets for Game Making

Is there a way someone can explain this in a way a new person to this can understand and accomplish this task?
I’ve build a game, but I am unable to share it, and I’m not able to post to facebook.

What must I do to the game to add it to facebook?