godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.23k stars 21.04k forks source link

Linking Godot project in Xcode results in entire project folder in archives #43271

Open tommiemartin opened 3 years ago

tommiemartin commented 3 years ago

Godot version: 3.2.3 stable xcode 11.3

When exporting for iOS and linking the Godot project in Xcode, the entire project folder is added to the archive that is then uploaded to App Store Connect. This includes any asset sub-folders and the .import folder which may contain no longer valid .stex resources.

a 200mb export (arm64 only) without a linked Godot project becomes a 600mb export using the linked project instructions per the docs.

https://docs.godotengine.org/en/stable/getting_started/workflow/export/exporting_for_ios.html

Minimal reproduction project: Export a project for ios and link existing Godot project. Create an archive, 'show in finder' and 'show package contents' on products > application > app. Compare folder structure and size to an archive created without a linked project.

naithar commented 3 years ago

@tommiemartin what do you want to achieve by linking Godot project to already exported Xcode project?

If you link any folder with create folder reference mode to any Xcode project it will add a copy files build step, which copies entire directory including hidden files and folders. This files also will be treated as bundle files, so they will not be removed or affected by App slicing on archive upload to App Store. This results in increased app size which cannot be affected by App Store upload process. So this behavior is expected.

If the resulting .xcarchive file is 200mb in size, it would probably be sliced to ~30MB for device when uploaded to App Store, but this mostly depends on assets only. For example empty Godot project is 18-20MB in size when installed on device. You can check on-device app size in App Store Connect portal after uploading your .xcarchive.

But as I said files and folders that are treated as bundle files most likely will not be removed.

tommiemartin commented 3 years ago

@naithar thanks for the explanation and yes it behaves how you stated. The problem is this is the suggested way to edit in the Godot editor and build in xcode without additional exports per the link above. My current project is 3d with a 200Mb of assets and this was resulting in the .import and resource folder ending up in the archive which was a lot of unwanted bloat.

As a side note not sure if the apple suggested on-demand resourcing / 'asset tagging' will be implemented going forward but this would also be very useful for asset heavy games.

naithar commented 3 years ago

The problem is this is the suggested way to edit in the Godot editor and build in xcode without additional exports per the link above.

You can also use Import .pck to only import .pck file which contains code and assets to keep Xcode project untouched. But you don't really need editing mode when you upload application to App Store, so it's size shouldn't be affected.

As a side note not sure if the apple suggested on-demand resourcing / 'asset tagging' will be implemented going forward but this would also be very useful for asset heavy games.

Well, you can probably create a correct proposal for this feature to be added into engine.

tommiemartin commented 3 years ago

Yes, simply re-exporting the .pck and overriding the existing one in the xcode project directory is a much cleaner way to handle this. Perhaps we should have a iOS re-export .pck button next to the android live edit button.

naithar commented 3 years ago

There are some WIP PRs for one-click deploy/live edit for iOS: https://github.com/godotengine/godot/pull/33086. But I don't think re-export .pck should be at live edit section.

lucassardois commented 2 years ago

Bumping this issue because to me, this is a major pain when developing to ios and there seems to be no reasonable workaround...

tommiemartin commented 2 years ago

Bumping this issue because to me, this is a major pain when developing to ios and there seems to be no reasonable workaround...

The way I got around this was too keep my project folder clean of any unnecessary files or folders. The biggest one to watch out for it the folder that contains all the .stex files and textures. From what I recall (haven't used the engine in a while) textures remain in this folder even if not referenced anywhere in your project. I sorted by size and removed things I was certain it didn't need. Make sure to make a full project backup before doing this. Deleting a referenced stex file can cause the project to hang while loading. You might have to redo materials if you delete the wrong things here but with adequate cleanup the size will be about the same as the android version.

Edit: also it might have had something to do with just manually copying the godot folder after any changes into the xcode project folder (instead of linking as described in the instructions). It's been over a year so a bit fuzzy on the workflow but it is possible make the apple uploads normal.