Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by rmccabe82 · Jan 27, 2015 at 07:01 PM · unity 4.6asset bundlesdownloadable content

How to - Dynamic content and asset bundles

Hi,

I'm relatively new to new to Unity development. I have content I will need loaded after the game has been deployed and I'm slightly confused on how to use asset bundles.

I have created a sample asset bundle using this tutorial:

http://docs.unity3d.com/ScriptReference/BuildPipeline.BuildAssetBundle.html

I have code on how to use asset bundles using this tutorial:

http://docs.unity3d.com/Manual/DownloadingAssetBundles.html

What these tutorials don't tell me is the following:

a) Are the assets literally just held on an FTP server somewhere or do you need to setup an "asset server"? I do have one setup and it looks to be more about version control.

b) how to a take an asset bundle and upload it to the server? If the server is nothing more than an FTP server, then I would be happy enough to write c# code to export to the location. I have an asset bundle I've built sitting on my c: drive, how do I make it available for download?

c) the tutorial for loading an asset references this line of code:

 using(WWW www = WWW.LoadFromCacheOrDownload (BundleURL, version)){

What is the bundle url? One code sample gives this url as an example:

 var www = WWW.LoadFromCacheOrDownload ("http://myserver.com/myassetBundle.unity3d", 5);

Again - I need to understand, is the myserver.com an asset server or just a file server somewhere, like IIS hosting a file? I've tried this via IIS and I get a 404 error.

d) Can anyone give me an example of loading an asset bundle from the local disk?

Thanks in advance!! Rob

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

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by LessThanEpic · Jan 28, 2015 at 01:13 AM

a) You can put the asset bundles wherever you want, either locally or on a server.

b) If you're putting the asset bundle on the server it doesn't really matter how you get it there. You can just use a regular ftp client if that's what you're used to.

c) The bundle url is just the path to where ever you put the bundle. The code example you reference is given the hypothetical situation that you have a website/server that you can hit by going to myserver.com and that you stored the asset bundle in the root folder of that server.

d) If you have an asset bundle on your local machine that you want to use you can just pass the file path (using forward slashes instead of backslashes). For example:

  var www = WWW.LoadFromCacheOrDownload ("C:/Users/Sean/Desktop/assetbundle.unity3d", 5); 
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 rmccabe82 · Jan 28, 2015 at 08:57 PM 0
Share

Thanks for your help! Ok so it seems the following:

a) These are just held on disk locally or on a server somewhere. Nothing special needs setup (like an "Asset Server"). Files should just be accessible through an address (local or web).

b) No problem, easy enough to understand. If on local disk, drop the file where I need OR if I just need to FTP the file to a server, no issues.

c) This is still slightly confusing. As a test I created an asset bundle, spun up local IIS on my Windows machine, created a web application in IIS and dropped the file into the web app directory to test (lets say http://localhost/mytestapp/samplebundle.unity3d).

When I try the code to pull it down using WWW.Load... it gives me 404 file not found (I get the same in a browser when I navigate to it but I didn't expect that to work). It's kinda like IIS doesn't know how to respond to the request. I tried the same thing on a web server I have public web facing (for arguments sake we'll say https://www.myserver.com/mywebapp/samplebundle.unity3d). This also responded with a 404 error (file not found).

Not sure how to make this work. Do I need to enable some extensions on IIS to get the correct response? Or am I over thinking this?

d) Ok - local machine seems fine. Thanks for that! I got it going with this code for anyone else who needs it:

 string path = EditorUtility.OpenFilePanel("Load Bundle", "", "unity3d");
 
                    AssetBundle assets = AssetBundle.CreateFromFile(path);

         assets.LoadAll();
 

         var loadedObject = (GameObject)assets.mainAsset;
avatar image LessThanEpic · Jan 28, 2015 at 11:45 PM 0
Share

Using IIS locally is a whole different can of worms. If you're trying to load a local asset bundle I wouldn'I wouldn't mess with a server. Just use the actual file path (C:/whatever). If that works then your Unity scripts are working. The fact that you can't hit iis through unity or the browser is a server issue and not related to your game code.

avatar image LessThanEpic · Jan 28, 2015 at 11:46 PM 0
Share

Also if you this works you should mark the answer as accepted.

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

20 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

Related Questions

unity 4.6 hinge joint broken in asset bundles 1 Answer

How to import the object from server to unity 2 Answers

is there a way to pack whole level and distribute via asset bundles (scripts,meshes, etc...) - android 0 Answers

Build stripping and scenes in Asset Bundles 1 Answer

Savings texture to png and then making asset bundle 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