Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Plugin support #1185

Closed
naithar opened this issue Jul 10, 2020 · 1 comment
Closed

iOS Plugin support #1185

naithar opened this issue Jul 10, 2020 · 1 comment

Comments

@naithar
Copy link

naithar commented Jul 10, 2020

Describe the project you are working on:

iOS Game

Describe the problem or limitation you are having in your project:

Currently to make a custom module for iOS developers are required to implement it as part of the engine and make a custom engine binary to be used instead of one coming with iOS export template.
It's mostly okay if many modules are not required, but could turn into a mess, once number of modules starts to grow.
There could also be a propblem of shipping incorrect binary, since right now on reexport Godot clears the folder where iOS app is exported to.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:

register_modules/unregister_modules methods specific for iOS platform could be used to call register/unregister methods of native modules added to project.
This would perform the same register/setup routines that is happending right now, but would also give a developer control over which module gets loaded additinally simplifing this procedure.

Modules itself would be built in the same way as they are built right now, but as separate static(.a) library with godot's binary linked to them (ARKit modules is a good example for it). But with this changes it would not required for an engine to be build alongside the module every time module is added or gets changed. Only headers and built binary would be needed.

Modules would be bundled upon project export, and could use a special configuration file, like the one used for Android Plugins, to describe which binary and method should be used to register them.
Modules like GameCenter and InAppStore that's currently included in platform could also be changed to use this feature.
Adding a configuration file would also provide a way to list modules in export window as well as enable or disable this if needed.

Basically this changes would simplify modules loading on iOS and give developers a way to build iOS modules independently from engine source.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

Module configuration file could look like this (Android Plugin configuration file was taken as example):

[config]

name="MyPlugin"
binary="MyPlugin.fat.a"

[methods]

register="register_gamecenter_module"
unregister="unregister_gamecenter_module"

In os_iphone.cpp would reguire changes to call methods for register/unregister:

void godot_ios_register_modules();
void godot_ios_unregister_modules();

...

// instead of gamecenter and inappstore registration

godot_ios_register_modules();

...

// in cleanup

godot_ios_unregister_modules()

Resulting iOS's dummy.cpp file could look like this, when exporting reworked GameCenter and AppStore modules:


void godot_ios_register_modules() {
    register_gamecenter_module();
    register_appstore_module();
}

void godot_ios_unregister_modules() {
    unregister_gamecenter_module();
    unregister_appstore_module();
}

If this enhancement will not be used often, can it be worked around with a few lines of script?:

This can't be workaround as current module system does not give a way to dynamically include or exclude modules.

Is there a reason why this should be core and not an add-on in the asset library?:

Modules loading are part of the core. This changes would make it simplier.

@akien-mga
Copy link
Member

Fixed by godotengine/godot#41230.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants