• 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 kromenak · Jun 02, 2011 at 01:59 AM · prefabsceneassetbundle

Can I use Prefabs instead of Scenes for AssetBundles?

Hey everyone,

Just wanted to sanity-check an idea we've been throwing around. It came as a bit of a blow to us that you can't include scenes in asset bundles, since we were counting on this to deliver level packs for our Android/iOS game. I've heard that the ability to do this will be included in Unity 3.4, but we can't really count on that releasing before we launch.

As an alternative, we were thinking that we could create a prefab that includes all the unique elements of a scene and then include that prefab in an asset bundle with a name like "Pack2_Level3". So, essentially, we would be creating a prefab with all the level objects as children, naming it uniquely, and then packing it into an asset bundle.

Then, on the other end, we have a basic level with common elements, and we can then call

 AssetBundle.Load("Pack2_Level3")

to create unique levels without including scenes in asset bundles.

Does this seem reasonable? Has anyone used this method before? Are there any potential issues or limitations that I'm missing - ie memory on mobile devices, time required to load prefabs, prefab size? I feel that this idea is conceptually solid, but there might be some practical issue that I'm unaware of.

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
3
Best Answer

Answer by kdubb · Jun 02, 2011 at 02:28 AM

Not exactly an answer to your question but I am not sure you cannot do your first choice! Have you looked at BuildPipeline.BuildPlayer, specifically with the BuildOptions.BuildAdditionalStreamedScenes option? It allows you to download extra scenes (with assets included) in an asset bundle. I think what trips everybody up is that you cannot simply include scenes into the BuildPipeline.BuildAssetBundle call instead you must use the other BuildPlayer method to include them.

As an answer to your question...

This is exactly how you would create these extra levels (if you do not opt for the more direct method stated above). We are using something similar but we are using one asset bundle for the environment, another for the vehicle, another for the vehicle skin, etc. so that we can have a number of dynamic elements.

As far as memory goes just unload the asset bundle, and all the unused assets with it, and Unity will somewhat automatically reduce your memory requirements to the bare necessity.

As for loading time, on the iPhone (3GS+) and iPad has been nominal and for most of our stuff almost unnoticeable.

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 cmk2901 · Jun 02, 2011 at 07:14 AM 0
Share

Cool, thanks for the info! Have you had any luck using the StreamedScenes method? We had been under the impression that scenes couldn't be included from this forum post by the Unity CTO: http://forum.unity3d.com/threads/41638-No-BuildOptions.BuildAdditionalStreamedScenes?p=566632&viewfull=1#post566632

Thanks for the tip, we'll try this out in the next few days.

(btw, I am the original poster, but am unable to login with that account due to a server error page - new unity answers needs some work!)

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

AssetBundles question. Unity 5.2 0 Answers

Loading prefab from Server as AssetBundle, NO material/texture loading (PINK result) 1 Answer

Move Player to new scene without it resetting. 1 Answer

Player controlled prefab not moving in new Scene 1 Answer

Is it possible to create a scene from script and export it as an 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