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);
     }
 }
Ejemplo n.º 2
0
        private string DrawLabeledAssetPopup <T>(string label, string value, List <T> assets) where T : Asset
        {
            AssetList assetList = GetAssetList <T>(assets);
            int       index     = -1;

            int.TryParse(value, out index);
            int newIndex = EditorGUILayout.Popup(new GUIContent(label, string.Empty), index, assetList.names);

            return((newIndex != index) ? assetList.GetID(newIndex) : value);
        }