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 Roktom · Sep 09, 2016 at 03:40 PM · prefabrandomgenerationinfinite runnerchunk

Easy chunk prefab creation

In my infinity runner game, level is generated randomly , but after a while I decided to use predefined prefabs of parts of the level and place it randomly to make level more organised. However I still want to spawn each object in this level prefab from the script, not the entire prefab with all the models. The reason of this is because I want to use object pooling, as well as to add some variations to the objects in the level prefab when they spawn (randomly rotate,scale,etc).


I see one possible solution :

  1. in the editor we somehow create an array of objects we want to spawn , with position and rotation values.

  2. In game, when we instantiate new world area(chunk), we use this data and instantiate each object in the array from script.


However I don't know how to setup this prefab/array of objects with all the info, in a somewhat user friendly way , maybe it's possible to make a regular prefab with all the stuff , then some script saves all values into array (in editor, not in game) , or maybe there is much better way to do that ?

Comment
Add comment · 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 Sergio7888 · Sep 10, 2016 at 07:56 AM 1
Share

You can save data in a ScriptableObject and with a script create and positionate GameObjects based on the saved data, see Introduction to Scriptable Objects

avatar image Roktom Sergio7888 · Sep 10, 2016 at 08:35 AM 0
Share

Gonna check it out right now !

avatar image Roktom Sergio7888 · Sep 10, 2016 at 01:09 PM 0
Share

Ok . i learned a little bit about scriptable objects, that's a good information to know , gonna use Scriptable objects for level generation settings, and chunk data saving, However I still need information regarding how to easily save all the data into the Scriptable object .

Right now I think about using special script , with custom button in the inspector , pressing this button will get all the children in the chunk (all chunk objects are children of chunk root Game Object), and write data to the Scriptable Object generated for that particular chunk.

Don;t know if there are better solutions , but that's what came up to my $$anonymous$$d :)

0 Replies

· Add your reply
  • Sort: 

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

66 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to instantiate bunch of cubes randomly in particular direction? 0 Answers

How do I generate a grid of random shapes that tile perfectly? 0 Answers

Help with simple generation problem 0 Answers

Generate Random Numbers a Distance Apart From Each Other 1 Answer

Randomly generate blocks on a flat map 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