Godot Engine
Integration Godot SDK
The DevToDev SDK extends the Godot engine in a modular way and supports platforms: MacOS, iOS, Android.
Requirements
Godot engine 4.0+ (Source code)
SCons 3.0+ build system.
SDK module source code (GitHub repository)
The SDK module installation
The SDK module is available in GitHub repository. Download the Source code of latest release and copy d2d_analytics folder to the modules(/godot/modules/
) folder of Godot engine source code.
To work in the Godot editor, compile the engine source code and the analytics module:
Find out more about compiling for MacOS
SDK Initialization
For initialization, add the following code at the start of your application:
You can find the AppID in the settings of the respective app in devtodev (Settings → SDK → Integration → Credentials).
config
- an object instance of GDDTDAnalyticsConfiguration
, which is used for specifying additional properties during the initialization
Parameter
Type
Description
CurrentLevel
Integer
The player level at the moment of devtodev SDK initialization. It’s optional but we recommend using it for improving data accuracy.
UserId
String
A custom user ID assigned by the developer. In the case of default calculation by device IDs, the identifier can be used for searching users in devtodev. In case the project uses calculation by user IDs, the parameter is mandatory because it becomes the principal calculation ID in devtodev.
TrackingAvailability
GDDTDTrackingStatus (enum)
The property allows or disallows devtodev tracking of the user. By default, it is set to GDDTDTrackingStatus.Enable
. SDK stores the previously assigned value. Pass GDDTDTrackingStatus.Disable
if the user opted out of tracking in line with GDPR.
LogLevel
GDDTDLogLevel (enum)
The level of logging the SDK activity. The GDDTDLogLevel.No
value is used by default. For troubleshooting during integration it is recommended to set it to GDDTDLogLevel.Debug
, and either switch it off GDDTDLogLevel.No
. Use GDDTDLogLevel.No
in the release version.
Example:
Project export
Export for MacOS
Open the Export Template Manager to download and install templates:
Open a terminal, go to the root directory of the engine source code. Compile a custom template for MacOS (see Building export templates for MacOS), select Debug or Release build and processor architecture. To support both architectures in a single Universal 2 binary, use lipo:
The next step is to prepare a custom template as a macos.zip archive. Don't forget to add the DTDAnalytics native library, copy libDTDAnalytics.dylib
to macos_template.app/Contents/MacOS/
.
Open the Export menu and specify the path to the prepared custom template:
Export for iOS
Open the Export Template Manager to download and install templates:
Open a terminal, go to the root directory of the engine source code. And compile a custom template for iOS (see Compiling for iOS). To work with the iOS simulator, compile the sources with the ios_simulator=yes
flag. To support both architectures in a single Universal 2 binary, use lipo:
The next step is to prepare a custom template as an ios.zip archive. Don't forget to add the DTDAnalytics native library, copy DTDAnalytics.xcframework
to ios_xcode/
.
In XCode project:
Add
DTDAnalytics.xcframework
to the project (with Do Not Embed specified)Create Bridging-Header. To do this, add any swift file to the project (don't delete it later) and select 'Create Bridging Header' in the dialogue box that appears.
Add frameworks:
AppTrackingTransparency.framework
AdSupport.framework
Export for Android
Сlick to install android templates:
After installing the template, an android folder will appear in your project.
Move the d2d_analytics/native/androidAnalytics.aar
to the android/plugins/ folder
in your project. You will also need to create an Analytics.gdap
file in android/plugins/
with the following content:
Next, Analytics should appear in the Plugins section, check it out:
The next step is to compile the Godot engine for Android (see Android compilation), choose debug or release build, and select the processor architecture.
After successful compilation execute the following commands:
In the next step in godot-4.0-stable/bin
you will see godot-lib.template_debug.aar
or
godot-lib.template_relaese.aar
.
You need to copy and replace this file to the previously installed template in your project at the path:
appName/android/build/libs/debug
- for debuggingappName/android/build/libs/release
- for release
After these steps, you are ready to export your Android app.
Make sure that Use Gradle Build
(in the Gradle Build section), Analytics
(in the Plugins section) and the previously compiled Architecture
(in the Architectures section) are selected.
Last updated