Unity-Technologies / Addressables-Sample

Demo project using Addressables package
1.31k stars 300 forks source link

ADDR 2172/2256 Make PAD project compatible with all platforms #59

Closed kirstenpilla closed 3 years ago

kirstenpilla commented 3 years ago

Fixed a bunch of things. Let me know if it's better to split this up into smaller PRs

README Updated the README to be more descriptive and better formatted. Mostly added new information that users were confused about on the forums. I'm a little concerned by how lengthy it is now, but maybe the length is necessary?

Project Files Added all platforms to the runtime asmdef file. Moved some scripts that weren't in the correct folder (Editor vs Runtime).

Added a Assets/PlayAssetDelivery/Build subfolder to hold the build json files. CustomAssetPackContent folder is moved inside it. image

Added a Assets/PlayAssetDelivery/Data subfolder to hold all .asset files.

Made the SampleScene canvas scalable on all resolutions.

Build Previously the custom build script (BuildScriptPlayAssetDelivery.cs) did 2 things: (1) create config files and (2) move bundles to the Assets/PlayAssetDelivery/Build/CustomAssetPackContent/{asset pack name}.androidpack folder. This behavior is now split up so that the build script only creates config files, and the file moving behavior is handled by the new build processor (PlayAssetDeliveryBuildProcessor.cs).

To accomplish this, BuildScriptPlayAssetDelivery creates new BuildProcessorData.json to store bundle locations (build path -> .androidpack folder).

BuildScriptPlayAssetDelivery no longer purges the entire Assets/PlayAssetDelivery/Build/CustomAssetPackContent folder when doing a new build. Instead it only deletes *.bundle files in the folder. Also deletes CustomAssetPacksData.json and BuildProcessorData.json prior to build. Users might want to include other assets inside the {asset pack name}.androidpack folders to add to their asset packs, so we don't want to delete their data.

Schema Added a "Include in Asset Pack" option in the Play Asset Delivery schema. It behaves pretty similar to the "Include In build" option in regular Addressables. Enabling the option will create asset pack files for the group when running BuildScriptPlayAssetDelivery.

A special helpbox appears when asset pack is set to "install-time": image

Runtime Converted AddressablesInitSingleton.cs to a simple singleton class (PlayAssetDeliveryRuntimeData.cs) Moved all initialization logic to an initialization object (PlayAssetDeliveryInitialization.cs)