-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFBscript.cs
48 lines (43 loc) · 867 Bytes
/
FBscript.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Facebook.Unity;
public class FBscript : MonoBehaviour {
void Awake()
{
FB.Init (SetInit, OnHideUnity);
}
void SetInit() {
if (FB.IsLoggedIn) {
Debug.Log ("FB is logged in");
} else {
Debug.Log ("FB is not logged in");
}
}
void OnHideUnity(bool isGameShown)
{
if (!isGameShown) {
Time.timeScale = 0;
} else {
Time.timeScale = 1;
}
}
public void FBlogin()
{
List<string> permissions = new List<string> ();
permissions.Add ("public_profile");
FB.LogInWithReadPermissions (permissions, AuthCallBack);
}
void AuthCallBack(IResult result)
{
if (result.Error != null) {
Debug.Log (result.Error);
} else {
if (FB.IsLoggedIn) {
Debug.Log ("FB is Logged In");
} else {
Debug.Log ("FB is Not Logged In");
}
}
}
}