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
0
Question by Hybrid1969 · Mar 05, 2015 at 01:21 AM · loadleveladditive

Passing variables to LoadLevelAdditiveAsync

Im currently looking at using LoadLevelAdditiveAsync to improve loading the large tiled city i dynamically generate by streaming the tiles as the player moves around.

My idea is to have a single scene with a gameobject/script that instantiates the required prefab and sets the tiles rotation(the same tile can have 4 positions) and position plus, any additional street decoration.

I would then call that scene with LoadLevelAdditiveAsync but the problem is how do I pass the prefab/rotation/postion info.

Any ideas?

Comment
Add comment · Show 4
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 meat5000 ♦ · Mar 04, 2015 at 04:49 PM 0
Share

You can load in a whole scene, not parts from inside it.

Otherwise you'd load resources.

avatar image Hybrid1969 · Mar 04, 2015 at 09:57 PM 0
Share

Sorry but im not sure what you mean.

Currently on a mid size map im loading 500 prefabs with each prefab containing 2-6 building models. each prefab currently 50 unity units square.

The issue centers round the problem of instantiating 2000+ objects and thats without starting to add any serious detail

avatar image meat5000 ♦ · Mar 05, 2015 at 12:12 AM 0
Share

For the additive loading approach you need to make smaller scenes with these prefabs contained and set up. LLAA call will load in a scene, not prefabs. To load in prefabs you use the Resources Folder.

avatar image Hybrid1969 · Mar 05, 2015 at 08:05 AM 0
Share

Oh I see what you mean now.

$$anonymous$$y reason for using loadleveadditiveasync ins$$anonymous$$d of resource load, is im trying to mitigate the freezing up of Unity as it tries to instantiate masses of complex prefabs in one hit.

And so my intention is to create a type of dynamic strea$$anonymous$$g but ins$$anonymous$$d of using on a sliced terrain i want to use it on a sliced city, which happens to be made up of dynamic prefabs.

If i did it the traditional way of a scene slice i would end up with 1000's of scenes.

Unless ive missed the point of load resource.

Any constructive advice is appreciated.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by jnt · Mar 12, 2015 at 03:01 PM

We are creating a similar environment.

This subject has been discussed before somewhere else that I can't find right now, but, one way to do it (but I'm not sure how this is going to affect the performance), is to have your whole scene in a parent object, then in a script get a reference to that object using:

GameObject.Find("parentObjectName");

Then manipulate it's transform rotation/position to how you want it.

The problem you are going to encounter is moving the navmesh and loading the lightmaps.

Unity are working on resolving the lightmap issue, but as for the navmesh, we've decided to use the A* Pathfinding Project for creating navmeshes that we will be able to move, and that is working for us so far.

Comment
Add comment · Show 2 · 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 Hybrid1969 · Mar 12, 2015 at 04:19 PM 0
Share

makes sense but how do you get around specifying which prefab you want.

I have a grid made up of prefabs with each gird space/prefab chosen randomly/dynamically.

So do you have a scene for each prefab and then limit the amount of prefabs you can pick from?

avatar image jnt · Mar 17, 2015 at 10:00 AM 0
Share

Yes you would just have each "tile" as a scene, with the root gameobject containing all art objects - whether they are prefabs or not is inconsequential. You could still pick the scene you want to load randomly, then position the root gameobject at the right place in the world.

So do you have a scene for each prefab and then limit the amount of prefabs you can pick from?

I don't think this would limit you any more than loading prefabs, I'm sure you can additive load a scene more than once... but haven't tried.

avatar image
0

Answer by Hybrid1969 · Mar 16, 2015 at 01:38 PM

Update:

Although I did find some interesting solutions, I was unable to get this to work in the way i wanted.

However in trying out different solutions i discovered that a runaway Co-routine had been happily running in the background slowly but surely causing chaos to my map generation and rendering, sucking up valuable frames for no reason.

WARNING TO ALL or (How to waste a lot of Dev time needlessly)

Co-routines are great but an absolute menace if your not careful. Keep track of them, especially if you are nesting them and don't use them if you don't have to. I am working on a sensible way to keep track of all my co-routines so Im not a berk again.

Comment
Add comment · 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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Finding the root GameObjects in the scene ? 8 Answers

What is the standard solution for preserving level data? 0 Answers

Objects unmovable after calling LoadLevelAdditive? 0 Answers

How to load enlighten lightmaps correctly at runtime? 2 Answers

Resource Limitation Safety for LoadLevelAdditive 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