• 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
Question by RealMTG · Oct 06, 2013 at 01:37 AM · randomgenerationroom

Random Room Generator

Hello!

I would like to create a script that allows the map to be created randomly everytime you play it, but I have no idea how I can code it.

The script will use prefabs to create the rooms. You have to create the prefabs and put them in your assets. Then you can set the amount of rooms you can have. Like 2 dead end rooms, 5 hallways and 1 ending. The map will be created once the game is started. To make so the rooms connect, you have to set a emptry game object at each side where you want a new room to be created. The empty game object have to clip in the end of the side. This is head to explain but there us a picture lower down on the page. The thing I just said doesn't really have to be done. Only in the worst cases. I think there would be a easier way to do this. The rooms will then randomly get created with the brefabs and it will try and avoid to clip trough another room.

That is how I want a script to work but I have no idea how to script it so if you would know, pleas etell me! :)

alt text

Comment

People who like this

0 Show 3
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 RyanZimmerman87 · Oct 06, 2013 at 01:40 AM 0
Share

I suggest you put some more details about this problem and you might get some good answers. If all the room prefab pieces are the same size you may be able to do some sorta simple math to position each new piece.

Not sure how you intend to wall off the area though. Will you be detecting the end points of the random generation and create a wall to close the room instead of adding more pieces? The empty game objects on the end could be useful for something like that but might not be necessary depending on how you size everything and keep track of all the locations.

avatar image spawninggrounds · Sep 25, 2016 at 09:55 AM 0
Share

Did you ever get anywhere with this? I have a similar need.

avatar image RealMTG spawninggrounds · Sep 25, 2016 at 10:00 AM 0
Share

Hey, I ended up getting DunGen from the assets store and that works really well.

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by RealMTG · Sep 25, 2016 at 10:03 AM

For those who are interested in this, I would recommend you get DunGen from the assets store. It's a little bit pricey but it works really well and it's worth the money!

Comment

People who like this

0 Show 0 · 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.

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

19 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

Related Questions

Help with Generating Random Tiles 1 Answer

Random Button / Plane Generation. 0 Answers

random generated room system -1 Answers

Random number different from previous generated. 6 Answers

Generate an object in random positions ? 1 Answer


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