Ejemplo n.º 1
0
 private string DrawAssetPopup <T>(string value, List <T> assets, GUIContent assetLabel) where T : Asset
 {
     if (assets != null)
     {
         AssetList assetList = GetAssetList <T>(assets);
         int       id        = -1;
         int.TryParse(value, out id);
         int index = assetList.GetIndex(id);
         int newIndex;
         if ((assetLabel == null) || string.IsNullOrEmpty(assetLabel.text))
         {
             newIndex = EditorGUILayout.Popup(index, assetList.names);
         }
         else
         {
             newIndex = EditorGUILayout.Popup(assetLabel, index, assetList.names);
         }
         return((newIndex != index) ? assetList.GetID(newIndex) : value);
     }
     else
     {
         EditorGUILayout.LabelField("(no database)");
         return(value);
     }
 }