How to add Conditional Compilation Directives to permit iOS exporting?

Godot Version

4.6 (NOT .net)

Question

I have a project that I export to Windows, SteamDeck, and iOS. I use GodotSteam plugin for Windows and SteamDeck, but not for iOS. On the iOS export, I exclude the GodotSteam addon like so:

However, any reference to that plug in code will cause a compilation error per addon reference in xcode and cause the game to crash. (blank grey screen).

Before every export to iOS, I currently have to go through the code and comment out every reference to the plugin. Then uncomment when exporting to other devices.

While I understand that the iOS export template is experimental in 4.4 due to the plist and display server errors. It mostly works with the manual intervention mentioned above.

Has anyone figured out a way to add conditional compilation directives to Godot to allow exports to iOS?

You will need to use Engine.get_singleton() instead of accessing the Steam object directly.

More info:

https://godotsteam.com/tutorials/remove_steam/

1 Like

holy moly that works! As long as I exclude the addon directory, and apply the fix you listed above… it compiles (with export template errors, but I think issues are setup for that). But it runs! w00t ! Now to try to integrate game center to get the gameplayerid lol

(edit): sorry! I should have said thank you. I should apply this pattern to IOS specific plugins as well :slight_smile: