Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Godot-Facebook Script
Godot Scene
Node
>>LoginButton
>>ShareButton
>>LoginStatus
extends Node
var fb
var app_id = ""
var app_url = ""
var app_img_url = ""
onready var loginStatusLabel = $LoginStatus
func _ready():
var labelStatus = str("Godot Instance Id: ", get_instance_id())
loginStatusLabel.text = labelStatus
if(Engine.has_singleton("GodotFacebook")):
fb = Engine.get_singleton("GodotFacebook")
fb.init(app_id)
fb.setFacebookCallbackId(get_instance_id())
func login_success(token):
var result = str('Facebook login success: %s' % token)
loginStatusLabel.text = result
print(result)
func login_cancelled():
var result = str('Facebook login cancelled')
loginStatusLabel.text = result
print(result)
func login_failed(error):
var result = str('Facebook login failed: %s' % error)
loginStatusLabel.text = result
print(result)
func _on_LoginButton_pressed():
if fb != null:
fb.login()
func _on_ShareButton_pressed():
if fb != null:
fb.appInvite(app_url, app_img_url)
@atologist-pratik

This comment has been minimized.

Copy link

commented May 8, 2019

Hello vini-guerrero,

have you managed to implement FacebookLogin in ios??

i get your reference from This Link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.