Introduction
In this article, I’ll show you how to add the official Godot plugin for integrating with Apple’s Game Center to your project.
First off, what is Game Center? For those unfamiliar, itās a feature available on iOS devices like iPhones and iPads. By signing in with an Apple ID, Game Center records achievements and allows players to compete on leaderboards in supported games. Developers can set achievements, define their completion criteria, and decide what to compete for on the leaderboards.
Using the Game Center plugin in Godot, you can easily integrate these features into your games, which is pretty awesome.
By the way, you can find the official documentation and source code at the Godot iOS plugins repository , so take a look there first. If there’s anything you don’t quite understand, you can always come back to this article.
Author's Environment at the Time of Writing
Godot Version: 4.2.1
Computer Model: MacBook Air M1, 2020
OS: macOS 14.4.1
Clone the Plugin Repository
First, head over to this Github page and follow the steps there. However, theyāre not very detailed, so I’ll explain the nitty-gritty parts here.
Start by opening your Terminal (Mac) or Command Prompt (Windows) and navigate to where you want to clone the repository. It can be outside your game project folderāactually, that might be better if you plan to reuse the Game Center plugin in other projects.
Letās say you decide to use the folder ~/Godot/Plugins
. To navigate there, use:
cd ~/Godot/Plugins
Once youāre there, clone the GitHub repository and its submodules with the following command:
git clone --recursive https://github.com/godotengine/godot-ios-plugins.git
If cloning the submodules fails and you see an error, follow these steps. First, navigate to the newly cloned local repository:
cd godot-ios-plugins
Then, try this:
git submodule update --init
Next, update the godot
submodule:
cd godot
git fetch
git checkout origin/<branch you want to use>
# For example, if you want version 4.2
git checkout origin/4.2
Generate the Godot Header
Now, letās create something called a “Godot header.” It helps make Godot features compatible with iOS languages like Objective-C or Swift.
Navigate to the godot
folder within godot-ios-plugins
:
cd godot-ios-plugins/godot/
The build command you’ll use looks like this:
scons platform=ios target=editor
If you encounter issues, the fix I found helpful was documented here .
After building the header, you’ll need to build the .a static library. Return to the main repository directory and use these commands:
scons target=release_debug arch=arm64 simulator=yes plugin=gamecenter version=4.0
./scripts/generate_static_library.sh gamecenter release_debug 4.0
Then, build the .xcframework library:
./scripts/generate_xcframework.sh gamecenter release_debug 4.0
Add the Plugin to Your Godot Project
Follow the official Godot documentation for Creating iOS plugins but note these tips.
First, you need to create a folder for iOS plugins in your Godot projectās root directory, like so: ~/Desktop/my_game/ios/plugins
.
Copy godot-ios-plugins/plugins/gamecenter/gamecenter.gdip
and godot-ios-plugins/bin/gamecenter.release_debug.xcframework
into this folder. Rename gamecenter.release_debug.xcframework
to gamecenter.xcframework
.
Set Up Export
Finally, set up your export settings in Godot. Open the Export panel from the Project menu and ensure the Game Center plugin is enabled under the iOS options. Specify an export path outside your project directory to avoid recursion issues.
Conclusion
That’s it for adding the Game Center plugin to your project. Thanks for reading! If something doesnāt work, feel free to highlight any issues, and I’d appreciate your feedback.
Lastly, allow me to plug my games that use the Game Center plugin. Check out Slashing Samurai and Lovely Solitaire on the App Store. Thanks!
š¹ Slashing Samurai
Test your reflexes and timing! Control a samurai and slice through objects falling from the sky in this addictive, one-handed casual game.
![](/images/portfolio/slashing_samurai/app_icon/icon.png)
š Lovely Solitaire
Enjoy the classic Klondike solitaireānow available on your mobile device! Play Lovely Solitaire, now on the App Store.
![](/images/portfolio/lovely_solitaire/app_icon/app_icon.png)
ā£ļø Quick Hand Poker
When it comes to popular classic casino card games, poker is a standout. However, in the mobile casual game “Quick Hand Poker,” it has been transformed into a puzzle game. The controls are simpleājust touch the cards as quickly as possible to form as many poker hands as you can! Available now on the App Store!
![](/images/portfolio/quick_hand_poker/app_icon/app_icon.png)