umasteeringgroup / UMA

Unity Multipurpose Avatar
MIT License
727 stars 167 forks source link

Fix issue where adding an AnimatorController to the indexer adds it a… #301

Closed itsmeted closed 4 years ago

itsmeted commented 4 years ago

In UMAAssetIndexer.cs, the AnimatorController to RuntimeAnimatorController mapping for the UMAAssetIndexer.TypeToLookup dictionary is ifdefed for UNITY_EDITOR since it is part of the UnityEditor namespace. When we add an AnimatorController to our UMA Global Library, it sets the AssetItem._BaseTypeName to "AnimatorController".

When a standalone build is made with this, the an KeyNotFoundException is thrown when accessing the AssetItem._Type since AssetItem._BaseTypeName is defined as "AnimatorController" instead of "RuntimeAnimatorController". In editor this works since we have AnimatorController in the UMAAssetIndexer.TypeToLookup, but in a standalone build this fails.

This change ensures that the AssetItem._BaseTypeName when we add a AnimatorControllor to the UMA Global Library is set the "RuntimeAnimatorController" instead of "AnimatorController", and the AssetIndexer.asset will have a recognized type when it loads the library.

Jaimi commented 4 years ago

Thanks! Since I've made so many changes to UMAAssetIndexer.cs, I just went ahead and merged your change manually into my work branch. I'll close this out, but thank you for finding this!