Debug in Xcode
Debug Swift code written for Godot in Xcode.
DebugInXcode.mdOverview
Debugging your SwiftGodot-based extensions using Xcode can either be done with a binary Godot executable that you got directly from the Godot project, or using your own build of Godot.
Make an Official Godot Engine debuggable
These steps are only required if you are using an official Godot built. If you compiled your own Godot locally, you do not need to do folow any of these steps.
Download Godot Engine without .Net support version in the official website.
Add
com.apple.security.get-task-allow
entitlement and resign it.
mkdir -p /tmp/Godot
cp -R ~/Downloads/Godot.app /tmp/Godot/
cd /tmp/Godot/
codesign --display --xml --entitlements Godot.entitlements Godot.app
open Godot.entitlements
# By default Finder will choose Xcode to open .entitlements file.
# You can open and edit it through any other application which can handle xml.
# Add <key>com.apple.security.get-task-allow</key><true/> in the opened Editor Application
codesign -s - --deep --force --options=runtime --entitlements Godot.entitlements Godot.app
cp -Rf ./Godot.app ~/Downloads/Godot.app
Debug Swift code
Launch the re-signed Godot app, choose our target project and open it in Godot.
Open our Swift Package via Xcode and add breakpoints.
Choose Debug -> Attach to Process in the menu bar of Xcode and locate the existing Godot process here (Remember the pids of the existing Godot process).
Go to Godot Editor and launch the game.
Choose Debug -> Attach to Process in the menu bar of Xcode again and choose the new Godot process whose pid is not in the pids list we get in Step 3.
Trigger some event if needed and we’ll hit the breakpoints we have added in Step 2.
See also
Meet SwiftGodot
SwiftGodot allows developers to take new and existing Swift packages and use them as extensions for the Godot game engine.
Read MoreWorking in VS Code
Develop and debug SwiftGodot Code in Visual Studio Code
Read More