• 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 commodore · Oct 27, 2012 at 02:34 AM · errorcharacter customization

Character Customization error

Hello, I'm trying to add my own character to the Unity Character Customization demo but I keep getting this error:

KeyNotFoundException: The given key was not present in the dictionary. System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic.List`1[CharacterElement]].get_Item (System.String key) CharacterGenerator.PrepareConfig (System.String config) (at Assets/Plugins/CharacterGenerator.cs:113) CharacterGenerator.CreateWithConfig (System.String config) (at Assets/Plugins/CharacterGenerator.cs:79) Main+c__Iterator0.MoveNext () (at Assets/DressingroomExample/Main.cs:28)

My character follows all the same naming conventions as the demo's character. I can't seem to figure out what's wrong.

It points to this line in the code:

 foreach (CharacterElement e in sortedElements[currentCharacter][categoryName])
 {
     if (e.name != elementName) continue;
     element = e;
     break;
 }
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Loius · Oct 27, 2012 at 04:25 AM

Capitalization (and whitespace - in fact, every character) IS important. This is failing on either currentCharacter or categoryName (those are 'keys' in the sortedElements 'dictionary').

If your caps are right, check to be sure they're actually being added properly in the code before this point. You could find the ".Add" line, and before it, Debug.Log the value that's about to be added. That way you can see if your curchar and catname are being added.

Comment
Add comment · Show 2 · 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 commodore · Oct 27, 2012 at 04:31 AM 0
Share

I didn't write any of this code, it's all from the character customization demo. I had taken of the eyes. When I put them back it fixed that problem but now I'm getting "Number of bind poses doesn't match number of bones in skinned mesh."

avatar image Loius · Oct 27, 2012 at 04:33 AM 0
Share

That error is more complex. I can't remember what exactly causes it; try a Google search for the exact phrase. It's either something to do with breaking a skinned prefab (like removing the eyes - to fix that, just use the whole imported object without taking it apart), or having a malformed object in the first place (something needs to be fixed in the modeling program).

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

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

ApplicationException & KeyNotFoundException 2 Answers

KeyNotFoundException: The given key was not present in the dictionary. 1 Answer

Has anyone made Android build on Unity5? 5 Answers

How to Fix Compilier Errors? 0 Answers

Error when building lighting 4 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