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 /
  • Help Room /
avatar image
0
Question by Denkaa · Mar 15, 2016 at 06:26 PM · prefabmapprefab connection

Making random map, how to do this well?

Hello, I'm actually making a "Isaac-like". I made a script who load all the map in my prefabs and then instantiate them with a procedural generation. I think this part is ok. But my problem come from prefabs. In each Map I load, there are various amount of bushes (the bushes are childs prefab of the "Map"). I have actually 20 maps like that. I just changed the sprite of the bush, the original prefab changed, but not every ones in the maps prefabs. I would like to know how to link the bushes which are in the Map to the original prefab. And i would like to know if there are better way to do this. My maps is made of a grid so maybe it would be easier (or better) for the game to put the informations in a document the game will load? but i really don't know how to do this. If it's more convenient to do this, do you have some ressources about this?

If you don't understand me clearly, don't hesitate to ask me more details.

Thanks in advance

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
0

Answer by Oukalakakou · Mar 16, 2016 at 05:08 AM

Why not trying to serialize your maps. So your maps will not be prefabs anymore. You will just have to do one prefabs for each game object that can be in your map like the bush and so all your bushes will be connected because coming from the same prefab.

You will need a script to save and load maps though.

Comment
Add comment · Show 7 · 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 Denkaa · Mar 16, 2016 at 08:10 AM 0
Share

Serializing something is saving it in a file? (like a xml one?). I never did this, i really don't know how to do this. Do you have any tutorial?

Is it lighter than every maps in a prefab?

Thanks for your answer

avatar image Oukalakakou · Mar 16, 2016 at 08:17 PM 0
Share

Yes serializing is saving to a file. I don't know a good tutorial about map serialization but there is a good tutorial about persistent data for beginners in the unity tutorials here.

I don't know if it will be lighter but I think so because only relevant data will be saved,.

The spirit of doing that is to create some kind of converter that will create a file referencing your map or create a map after a file. It's not so difficult to achieve but it depends a lot about the kind of map you want to get.

Is it a grid map?

avatar image Denkaa Oukalakakou · Mar 17, 2016 at 03:05 PM 0
Share

Oh nice thanks. I'll check that. Yes it's a grid map. I guess serializing is easier with a grid map?

And do you know how to solve my problem without serialzing? (linking the bushprefab included in the mapprefab to the original bush prefab) (that doesn't seem clear...)

avatar image Oukalakakou · Mar 18, 2016 at 06:21 AM 0
Share

Serializing with a grid map could be easier because you just will have to save an array of data representing your game objects to instantiate.

You could link your bushes but I don't think you could do that with prefabs. What you want is something like a prefab of prefab.

Do more than one map is istantiated a the time or do you create a new scene for each map? I'm a big fan of isaac and I think for doing a game like that just one map have to be created and when you enter another you should enter another scene. So why don't create scenes ins$$anonymous$$d of prefabs for your map? Like that prefabs will be linked to instantiated game objects.

avatar image Denkaa Oukalakakou · Mar 18, 2016 at 08:26 AM 0
Share

Hum, I have a scene for each level (in isaac it's basement I, basement II, cave I ...). Do you think i have to make a scene for each map? (A map is the "square" which contains only few bushes and some ennemies). If I make a Scene for each map, won't it be heavy? And can i load many scenes in another scene?

(Thanks for helping me :D )

avatar image Oukalakakou · Mar 18, 2016 at 09:39 AM 0
Share

I don't think there is a good answer to your question. Sometimes you just have to make a choice and stick with it.

If I were to make this kind of game, I would have created a data structure representing my different rooms and how they connect to each other.

A scene is what is really loaded into your game so splitting your games in more scenes will certainly result in better performances. Why keep in memory rooms that are not visible?

avatar image Denkaa Oukalakakou · Mar 21, 2016 at 11:18 AM 0
Share

I want to keep them in memory because it's more like an old zelda than isaac. The full map is load, and the player can walk free between the "rooms".

I found some things like "poor man nested prefab" but i have to look further for 2D scripts. I'm a beginer and i don't have the time to learn how to serialize.

Thanks for your help @Oukalakakou

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

56 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

Related Questions

How do I loop sprites instead of stretching them?,How do I loop 2D sprites instead of stretching them? 0 Answers

[Solved] Instantiated objects spawn at diferrent x 1 Answer

[C#] Creating falling coins 1 Answer

Unity 2018.3 New prefab system How do I get rid of it? 1 Answer

Prefabs getting deleted in all scenes! 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