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 Excelerator · Sep 24, 2016 at 02:54 AM · arrayslimits

what are the limits of arrays?

So, how exactly do I find out how big I can make my arrays?

Do other big arrays have to make my other arrays be smaller?

Does this simply take more GB's of ram in a computer, or are there key bottlenecks to look out for?

I'd like to at least be able to predict if my array will be too big rather than just testing to see if it crashes.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by mezzostatic · Jan 09, 2017 at 11:45 AM

over 2 billion for boolean, it depends how much every element takes in bytes. 2.47 billion is the upper limit of integers in c#.

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

Answer by tanoshimi · Sep 24, 2016 at 06:26 AM

Arrays can be huge. They're the structure that Unity uses to store the vertices and triangles of every mesh in the scene, for example. What matters, performance-wise, is how you access the members of that array. You don't want to be iterating over all the members of a million-element array in a for loop or resorting that array every frame, for example.

Whatever bottlenecks you may have in your game, using arrays to store data is never going to be one of them.

Comment
Add comment · Show 6 · 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 Excelerator · Sep 24, 2016 at 04:44 PM 0
Share

Right. I'm just assu$$anonymous$$g a huge pile of data where you might simply look at one tiny piece of it at a time.

Say for example, you recorded every object's movement in Vector3 and Quaternion for every frame of the game. Imagine there are hundreds, maybe thousands of objects all being recorded.

At 60fps, how many days until your game crashes? I would not know.

Floating point problems are really easy to find. Just launch your physics objects out at really long distances and see all the amazing rounding error glitches. But I want to know the real limits of arrays. You say huge, but how huge? How many million?

Also, will slower computers crash sooner? These are all very important things to know.

avatar image tanoshimi Excelerator · Sep 24, 2016 at 05:15 PM 0
Share

Crashing is nothing to do with your framerate or having a "slower" computer - it's caused by memory allocation.

An array holds a set of references to the objects it contains. Each of those references is 4 bytes (on a 32bit system) or 8 bytes (on 64bit). So, multiply that by the number of elements to get an idea of memory requirements. A modern machine can comfortably hold several billion elements in an array.

avatar image Excelerator tanoshimi · Sep 24, 2016 at 05:53 PM 0
Share

so, it's based on the number of bytes per element? So, then how many elements depends on the data type like Int, float, Vector3, or if it is a link to an object/component. So, when you add it all together, it should be less than how much RA$$anonymous$$ your computer has?

Also, what I meant by FPS is when recording game object's motion. So, at 60FPS, in 2 days, your array's size would become 10,368,000. So, 10,368,000 Vector3's and 10,368,000 Quaternions times how ever many objects are in the game. Let's say 1000. So that comes to a total of 20,736,000,000 elements. That's only if someone decided to leave the game running for 2 days, and that there was no limit to how long you could record for. So, 20 billion.

But anyway. I know not a very realistic example, but it would be nice to sort of have an idea on how to budget these.

Show more comments
avatar image
0

Answer by Honour-Demon · Jun 05, 2019 at 08:36 PM

Hmmm 2016 Q. But here we Go.


2d array Example: (Variable memory allocation) + (array reference information).

(x*y* variable size) + (x*y* 4 x bytes) = 25 bytes + 100 bytes = 125 bytes if it was 5x5 byte array.


{I'm just using basic thought here. I didn't look up the values}. The same logic counts for any kind of dimensional array that uses a fixed size variable, like say a bool or Vector3 or int or etc.

So in short. How much Memory you got to work with. {Edit: Forgot the <-- actual Answer}.

Good Luck.

(Edit: Simplified Stuff)

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

55 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

Related Questions

Why does this loop throw an error if int questComplete rises above 1? 0 Answers

Managing In-Game Variables of Different Data Types 1 Answer

Defining a number of gameobjects from another gameobject 0 Answers

animation array trying to play all at once 0 Answers

Cannot Set Array Size in Inspector 2 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