The name `FB' does not exist in the current context

I got the FaceBook SDK and I’m learn about.
But, I have a problem in Unity that Visual Studio don’t show me !

I put everything (the scripts of the game and the script of FB SDK) under the same project in Visual Studio, only dependency is the Editor (that I create a reference to the Main Project and fixed the problem).

But the problem still happen. The Visual Studio correctly understand the FB class and your methods, but Unity not.

What is wrong ?

The error is from Menu.cs. What is line 45 of that file? Perhaps you are missing a using FB?

The problem it is the Facebook SDK and my scripts are in the same project, during the build in Visual Studio I don’t have errors or problems, but in Unity IDE really the editor show the message
Assets/Standard Assets/Scripts/Menu.cs(45,9): error CS0103: The name `FB’ does not exist in the current context

But all objects are in the same project !!!

Any ideas ?

Do you have using FB near the top of menu.cs?

I do, but mine still is giving me the same error as OP…

1 Like

In unity Project, i just put my c# script and Facebook SDK folder in Plugins Folder, it’s working fine for me.

2 Likes

I’m still having same error. I also tried to put my c# script and FB SDK folder in Plugins folder

using UnityEngine;
using System.Collections;
using Facebook;

public class FBManager : MonoBehaviour {

voidAwake ()
{
FB.Init (SetInit, onHideUnity);
}
}

I fixed problem by adding .Unity;

so it’s like this:

using Facebook.Unity;

2 Likes