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 itsMeDOUG · Feb 02, 2013 at 09:05 PM · arraylistresizeinfinitemultidimensional

Javascript Endless 3D Array

Hello all,

I have been working on my own voxel engine recently and it is going well, however I am having issues with storage in 3d or 2d arrays. Ideally, I would have an endless three dimensional array to store the chunks that I have created for runtime, but as far as I know, you cannot resize a multidimensional array. My question is: Is this true? If so, is there a better way around this? If not, how would you declare it? I seem to only be able to make multidimensional arrays by declaring size, such as:

 var cubeArray : GameObject[,,] = new GameObject[chunkSize, chunkSize, chunkSize];

Thanks in advance for any help!

-Doug

Comment
Add comment · Show 2
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 whydoidoit · Feb 02, 2013 at 10:02 PM 0
Share

Um endless - no matter how you do that - you will run out of memory faster than you think ;)

Were you intending to stream data to a disk or something?

You really need to write a function to map the world coordinate to the storage system rather than relying on arrays. Arrays like this will probably contain vast amounts of wasted space.

Next up - you probably can't do what you want with GameObjects, your best bet would be dynamically creating cubes in a mesh by modifying vertices and also trying to simplify the actual world compared to the representation (so it might be that the game has 4 cubes making a bigger cube, but while that condition persists you want to graphics hardware to draw just one cube).

avatar image itsMeDOUG · Feb 03, 2013 at 04:19 AM 0
Share

Ah, I mean just for holding them during the game. Also, I have my cubes all drawing in depending what faces are visible, made of tris and vertices manually. Thanks for the tips though.

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

10 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

Related Questions

A node in a childnode? 1 Answer

Can you set a string length when declaring it to a certain other number? 2 Answers

Enabled all gameobjects in array 1 Answer

Lists and Structs instead of Arrays? 4 Answers

Find specific element when duplicates exist in list. 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