Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gamecenter not working #26

Open
NeroNekro opened this issue Dec 8, 2021 · 2 comments
Open

Gamecenter not working #26

NeroNekro opened this issue Dec 8, 2021 · 2 comments
Labels

Comments

@NeroNekro
Copy link

NeroNekro commented Dec 8, 2021

Hello there,

I try to use the GameCenter Plugin, but it not works.

I use this piece of code:

if Engine.has_singleton("GameCenter"):
        print("Gamecenter aktiv")       
        game_center = Engine.get_singleton("GameCenter")
        var login = game_center.authenticate()
        var result = game_center.post_score({ "score": 100, "category": "birds_4", })
        var show = game_center.show_game_center({ "view": "leaderboards", "leaderboard_name": "birds_4" })
    else:
        print("iOS Game Center plugin is not available on this platform.")

Without the part game_center.authenticate() I get the error "player is nil". With this part the game_center open on iOS. Is there any function to authenticate without open gamecenter?

In the documentation is the dictionary a litte bit unclear. On one section the key called "score" in another section "value".

Furthermore I get the following error:

ERROR: Condition "!p_score.has("score") || !p_score.has("category")" is true. Returned: ERR_INVALID_PARAMETER
at: post_score (plugins/gamecenter/game_center.mm:124) - Condition "!p_score.has("score") || !p_score.has("category")" is true. Returned: ERR_INVALID_PARAMETER

on this link you get a little project, with a gamecenter function and a in app purchase function. Both not working.
https://1drv.ms/u/s!Ah2_A51TSFE1g7k0x5ylXLWFpLmoJQ?e=x1W2lU

thanks

@NeroNekro NeroNekro changed the title Gaamecenter not working Gamecenter not working Dec 8, 2021
@Calinou Calinou added the bug label Dec 8, 2021
@naithar
Copy link
Contributor

naithar commented Dec 10, 2021

Without the part game_center.authenticate() I get the error "player is nil". With this part the game_center open on iOS. Is there any function to authenticate without open gamecenter?

You should always authenticate user to use GameCenter functionality. On real device GameCenter controller will display single time.

Furthermore I get the following error:

https://github.com/godotengine/godot-ios-plugins/blob/master/plugins/gamecenter/game_center.mm#L124 post_score should contain both score and category keys.

@naithar
Copy link
Contributor

naithar commented Dec 10, 2021

Tested your project, I'm not getting the error that you have posted, but I'm getting script error:

2021-12-10 10:37:52.737761+0300 testapp[10264:10008889] 0
2021-12-10 10:37:52.737901+0300 testapp[10264:10008889] SCRIPT ERROR: Invalid operands 'String' and 'int' in operator '+'.
2021-12-10 10:37:52.738065+0300 testapp[10264:10008889]    at: _on_gamecenter_pressed (res://Control.gdc:50) - Invalid operands 'String' and 'int' in operator '+'.

You shouldn't use + sign for String and int which is result of methods, str(result) should help you with that.

Also category is a leaderboard identifier, not it's name, so this also can be an issue.

Edit:

Also, to test InAppPurchases you have to use TestFlight version of app or create StoreKit Configuration File, which will allow to test purchases in debug mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants