public void Start() { FB.facebook = this.FBGameObject.Facebook; FB.OnDLLLoadedDelegate(); FB.LogVersion(); MonoBehaviour.Destroy(this); }
public void Start() { FB.facebook = this.FBGameObject.Facebook; FB.OnDLLLoadedDelegate(); FB.LogVersion(); UnityEngine.Object.Destroy(this); }
/// <summary> /// If you need a more programmatic way to set the facebook app id and other setting call this function. /// Useful for a build pipeline that requires no human input. /// </summary> /// <param name="appId">App identifier.</param> /// <param name="cookie">If set to <c>true</c> cookie.</param> /// <param name="logging">If set to <c>true</c> logging.</param> /// <param name="status">If set to <c>true</c> status.</param> /// <param name="xfbml">If set to <c>true</c> xfbml.</param> /// <param name="frictionlessRequests">If set to <c>true</c> frictionless requests.</param> /// <param name="authResponse">Auth response.</param> /// <param name="onHideUnity"> /// A delegate to invoke when unity is hidden. /// </param> /// <param name="onInitComplete"> /// Delegate is called when FB.Init() finished initializing everything. By passing in a delegate you can find /// out when you can safely call the other methods. /// </param> public static void Init( string appId, bool cookie = true, bool logging = true, bool status = true, bool xfbml = false, bool frictionlessRequests = true, string authResponse = null, HideUnityDelegate onHideUnity = null, InitDelegate onInitComplete = null) { if (string.IsNullOrEmpty(appId)) { throw new ArgumentException("appId cannot be null or empty!"); } FB.appId = appId; FB.cookie = cookie; FB.logging = logging; FB.status = status; FB.xfbml = xfbml; FB.frictionlessRequests = frictionlessRequests; FB.authResponse = authResponse; FB.onInitComplete = onInitComplete; FB.onHideUnity = onHideUnity; if (!isInitCalled) { FB.LogVersion(); #if UNITY_EDITOR ComponentFactory.GetComponent <EditorFacebookLoader>(); #elif UNITY_WEBPLAYER || UNITY_WEBGL ComponentFactory.GetComponent <CanvasFacebookLoader>(); #elif UNITY_IOS ComponentFactory.GetComponent <IOSFacebookLoader>(); #elif UNITY_ANDROID ComponentFactory.GetComponent <AndroidFacebookLoader>(); #else throw new NotImplementedException("Facebook API does not yet support this platform"); #endif isInitCalled = true; return; } FacebookLogger.Warn("FB.Init() has already been called. You only need to call this once and only once."); // Init again if possible just in case something bad actually happened. if (FacebookImpl != null) { OnDllLoaded(); } }
private static void OnDllLoaded() { FB.LogVersion(); FacebookImpl.Init( appId, cookie, logging, status, xfbml, FacebookSettings.ChannelUrl, authResponse, frictionlessRequests, onHideUnity, onInitComplete); }