Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by carterdawson · Nov 28, 2018 at 05:26 PM · assetbundles

How do folks organize and download AssetBundles for different platforms?

Hi,

I have a multiplatform application, so I need to build the AssetBundles for each platform, and then I store them on my website, in a platform-specific directory, based on the buildTarget. So, the iOS AssetBundle goes into ./iOS, and StandaloneWindows into ./StandaloneWindows and so on.

So, when the Player needs to download the AssetBundle, it needs to construct the URL at runtime. But, the buildTarget is not available at runtime.

How do people deal with this sort of thing? It seems like such a basic problem, but I don't see a whole lot of people talking about it, so I must be missing something.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Bonfire-Boy · Sep 07, 2021 at 11:32 AM

Why do you need it to be available at runtime? A specific build of the player only works on one platform anyway, and it's available when building...

 #if UNITY_IOS
     const string folder="iOS";
 #elif UNITY_STANDALONE_WIN
     const string folder = "StandaloneWindows";
 #endif
 
 // and so on
Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DaveBurlingame · Jan 08 at 03:39 PM 0
Share

because we download them and I need to know which file to download

avatar image Bonfire-Boy DaveBurlingame · Jan 09 at 12:45 AM 0
Share

Same principle applies, whether you're keeping the platform-specific files in different folders on the server, and/or giving them different filenames (which is very much recommended - giving the same filename to ABs for different platforms would be madness IMO). You've got all the info you need when you build the app, you don't need to work it out at runtime.


But obviously, if you did need the info at runtime for some other reason, you could make it available in exactly the same way. The folder string shown for example, is in fact something that's available at runtime. that tells you what platform the app was built for.


If this doesn't work for you then please give more details of what you're trying to do. I've made a fair few apps which use platform-specific and versioned downloadable asset bundles and have to say this side of things has always been pretty straightforward. Its the versioning and dependencies side of things that can get complicated, rather than the platform-specific stuff.

avatar image carterdawson · Jan 08 at 06:29 PM 0
Share

Duh. That's a good point, @Bonfire-Boy . @DaveBurlingame - Bonfire is right. Set the string "folder" at compile time, and then use that value at runtime.

avatar image
0

Answer by DaveBurlingame · May 13, 2021 at 08:53 PM

I have the same question and could not find an answer. There is EditorUserBuildSettings.activeBuildTarget and Application.RuntimePlatform. They don't match up. And there is a very simple matrix at https://docs.unity3d.com/550/Documentation/Manual/AssetBundleFAQ.html but it's a guideline. So I am not sure how to do it other than to hard code it somewhere with a bunch of conditions

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DaveBurlingame · Sep 06, 2021 at 08:09 PM 0
Share

For better or worse, I decided to use 3 letter file extensions for the different platforms

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

97 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Convert Unity 2.x asset bundles to Unity 3.x 1 Answer

Loading scenes and scripts through assetBundles 1 Answer

Incorrect Intensity value of Light component loaded from Assetbundles 0 Answers

Unity 5 lightmapped scene assetbundle problem 2 Answers

Can a windows and an android app use the same assetbundle specified with no target?,Can Windows and Android apps run assetsbundles with notarget? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges