Quantcast
Channel: Questions in topic: "xcode"
Viewing all articles
Browse latest Browse all 1047

AssetBundleManager - what asset bundle URL to specify for iOS (Xcode simulator, Testflight, Appstore)?

$
0
0
Hello, For my Unity project that is targeting iOS, I'm attempting to use the Asset Bundle functionality with the AssetBundleManager helper (https://www.assetstore.unity3d.com/en/#!/content/45836). My intent is to have a couple of add on scenes available as app bundles (On Demand Resources in iOS) to reduce the initial app size, and only have them downloaded by the user when unlocked within the app. I've got it working as expected from the editor but I feel like I'm missing something simple to set this up to work from the device simulator in XCode, Test Flight, and the app store. I've basically just plugged in AssetBundleManager as is, tagged some scenes, generated the asset bundles, and run from the Unity editor using the "Local AssetBundle Server" option. I'm not using Simulation Mode nor putting my assets in StreamingAssets folder. I've created a resource collector based on the tutorial here (https://blogs.unity3d.com/2015/11/26/mastering-on-demand-resources-for-apple-platforms/) that adds my bundles to the iOS Xcode project when I build for that player. This all works great as expected in the editor: loading the scene from the local server using the LoadLevelAsync call in the AssetBundleManager class loads it from that bundle. So I'm ready to test the asset bundle loading running from my Unity iOS project in XCode. In the bundle loading initialization code there is a spot for specifying the source bundle URL. **What should this be set to if I'm not using streaming assets or deploying to my own http web server? I just want to test it from the simulator in Xcode using localhost, as well as have it work on TestFlight and the app store using those remote URLs.** // Use the following code if AssetBundles are embedded in the project for example via StreamingAssets folder etc: //AssetBundleManager.SetSourceAssetBundleURL(Application.streamingAssetsPath + "/"); // Or customize the URL based on your deployment or configuration //AssetBundleManager.SetSourceAssetBundleURL("http://www.MyWebsite/MyAssetBundles"); If I don't set that URL when downloading the asset bundle manifest immediately it obviously builds an invalid URL, with the AssetBundleManager logging this error: Failed downloading bundle iOS from iOS: unsupported URL Is there a nice way I can configure this to be handled for simulator development as well as test and production deployment? My Xcode project is set with "Embed Asset Packs in Product Bundle" to true, and I have the "Asset Pack Manifest URL Prefix" set to the default empty string. I notice that my resources after building the Xcode project are stored here with these settings, which seems right. /$HOME/Library/Developer/Xcode/DerivedData/Unity-iPhone-gepcjqmzrhbprfhlfinpkhzebhuy/Build/Products/Release-iphonesimulator/OnDemandResources/ There is an AssetPackManifestTemplate.plist in the simulator app bundle that provides the local URLs to the asset bundles, but I'm assuming I don't want to use this as my asset bundle URL, since it'll differ in Test Flight and the app store. Example: http://127.0.0.1/$HOME/Library/Developer/Xcode/DerivedData/Unity-iPhone-gepcjqmzrhbprfhlfinpkhzebhuy/Build/Products/Release-iphonesimulator/OnDemandResources/blah.assetpack I figure someone has this working at least in the simulator so it's probably something obvious I'm missing or misunderstanding. Thanks!

Viewing all articles
Browse latest Browse all 1047

Trending Articles