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
2
Question by infinitypbr · Mar 10, 2013 at 11:39 PM · databasedictionary

How to include a large dataset (dictionary is "too complex" for Unity)

Hello!

I'm building an app with a ton of quotes, so I'm using a dictionary to store the quotes / authors. However, now that I've got about 3000+ quotes, unity says:

Method loadThoughts:LoadThoughts () is too complex.

Is there a better way to include this data? In the end I'm likely to have 30,000+ entries.

Comment
Add comment · Show 4
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 Khada · Mar 11, 2013 at 02:09 AM 0
Share

Are you sure your not just running into a hardware limitation? Check how much free memory you have with as many items as possible loaded into the dictionary.

avatar image infinitypbr · Mar 11, 2013 at 02:41 AM 0
Share

Well, I'm not sure how to check memory etc at this point. The error occurs when I run in the editor, and simply won't load any information into the dictionary.

avatar image infinitypbr · Mar 11, 2013 at 02:50 AM 0
Share

Also, just to be clear, removing half the quotes in the dictionary load script, fixes the problem. So I'm just looking for another way, something that allow for many thousands of entries.

avatar image Khada · Mar 11, 2013 at 03:47 AM 0
Share

The thing is that there's no practicable limit to the number of items a dictionary can store (it can store something like 4 billion items provided you have the memory resources), and so it may be a hardware limitation. How many characters (including punctuation and spaces) is your average quote? If we call this average number 'q' then q 1024 1024 is how many megabyets are being used for the dictionary and if your quotes are large and your memory resources limited, this might be the cause of your issue.

I just loaded 10,000,000 strings, each 1024 characters in length into a dictionary so whilst I doubt that it's a hardware restriction, the issue isn't that the dictionary has an item limit.

Use the resource monitor (memory tab) to see how much memory the unity process is using when you run, and to see how much free memory your system has at the time.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by sed · Nov 06, 2014 at 06:07 PM

We have just runned into the same issue when statically initializing huge dictionary (100k+ entries). We wanted to initialize it statically to make the load time as short as possible.

 private static Dictionary<string, bool> _dict = new Dictionary<string, bool>() {
  {"the_tag", true},
  // 99k more entries here
 
 };

It seems it doesn't work with 100k in a singe dictonary, bt 10x10k dictionaries in separate classes work fine.

The solution we decided to stick to is to divide the class into a few classes and use one as a hub for accessing inner dictionaries.

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

13 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

Related Questions

Determine an index of a closest number in a database, from a user's input 1 Answer

how to split TextAsset into a Dictionary? 0 Answers

Storing Items in a Building Blueprint 0 Answers

retrieving data from SQLite to UNITY 1 Answer

How to have Database of Dictionary elements with online images??? 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