mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-07 08:20:11 +01:00
Android IAP: Check for singleton before getting
Fixes #273, fixes #212, fixes #godotengine/godot#22082.
This commit is contained in:
@@ -15,9 +15,14 @@ signal consume_not_required
|
||||
signal sku_details_complete
|
||||
signal sku_details_error
|
||||
|
||||
onready var payment = Engine.get_singleton("GodotPayments")
|
||||
var payment
|
||||
|
||||
func _ready():
|
||||
if Engine.has_singleton("GodotPayment"):
|
||||
payment = Engine.get_singleton("GodotPayments")
|
||||
else:
|
||||
print("GodotPayment singleton is only available on Android devices.")
|
||||
|
||||
if payment:
|
||||
# set callback with this script instance
|
||||
payment.setPurchaseCallbackId(get_instance_id())
|
||||
|
||||
Reference in New Issue
Block a user