Creating iOS plugins
iOS plugins allow you to use third-party libraries and support iOS-specific features like In-App Purchases, GameCenter integration, ARKit support, and more.
An iOS plugin requires a configuration file, a binary file which can be either .a
static library or .xcframework
containing .a
static libraries, and possibly other dependencies. To use it, you need to:
Copy the plugin’s files to your Godot project’s
res://ios/plugins
directory. You can also group files in a sub-directory, likeres://ios/plugins/my_plugin
.The Godot editor automatically detects and imports
.gdip
files insideres://ios/plugins
and its subdirectories.You can find and activate detected plugins by going to Project -> Export… -> iOS and in the Options tab, scrolling to the Plugins section.
When a plugin is active, you can access it in your using Engine.get_singleton()
:
Creating an iOS plugin
At its core, a Godot iOS plugin is an iOS library (.a archive file or .xcframework containing static libraries) with the following requirements:
The library must have a dependency on the Godot engine headers.
The library must come with a
.gdip
configuration file.
An iOS plugin can have the same functionality as a Godot module but provides more flexibility and doesn’t require to rebuild the engine.
Here are the steps to get a plugin’s development started. We recommend using Xcode as your development environment.
See also
The Godot iOS plugins.
The Godot iOS plugin template gives you all the boilerplate you need to get your iOS plugin started.
Create an Objective-C static library for your plugin inside Xcode.
Add the Godot engine header files as a dependency for your plugin library in
HEADER_SEARCH_PATHS
. You can find the setting inside theBuild Settings
tab:In the
Build Settings
tab, specify the compilation flags for your static library inOTHER_CFLAGS
. The most important ones are-fcxx-modules
,-fmodules
, and-DDEBUG
if you need debug support. Other flags should be the same you use to compile Godot. For instance:
Add the required logic for your plugin and build your library to generate a
.a
file. You will probably need to build bothdebug
and target.a
files. Depending on your needs, pick either or both. If you need both debug and release.a
files, their name should match following pattern:[PluginName].[TargetType].a
. You can also build the static library with your SCons configuration.The iOS plugin system also supports
.xcframework
files. To generate one, you can use a command such as:
Create a Godot iOS Plugin configuration file to help the system detect and load your plugin: