Example #1
0
 public static void ViewModelField(SerializedList viewModelList)
 {
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.LabelField("View Model", labelOptions);
     viewModelList.Index = EditorGUILayout.Popup(viewModelList.Index, viewModelList.Values.ToArray());
     if (UnityEngine.GUILayout.Button("Open"))
     {
         var type  = ViewModelProvider.GetViewModelType(viewModelList.Value).Name;
         var str   = AssetDatabase.FindAssets(type).FirstOrDefault();
         var path  = AssetDatabase.GUIDToAssetPath(str);
         var asset = EditorGUIUtility.Load(path);
         AssetDatabase.OpenAsset(asset);
     }
     EditorGUILayout.EndHorizontal();
 }
Example #2
0
        public static void BindingField(string label, SerializedList propsList, SerializedList pathsList = null)
        {
            bool hasPaths = pathsList != null && pathsList.Values.Count > 0;

            EditorGUILayout.BeginHorizontal();

            if (!string.IsNullOrEmpty(label))
            {
                EditorGUILayout.LabelField(label, labelOptions);
            }

            propsList.Index = EditorGUILayout.Popup(propsList.Index, propsList.Values.ToArray());

            if (hasPaths)
            {
                pathsList.Index = EditorGUILayout.Popup(pathsList.Index, pathsList.Values.ToArray());
            }

            EditorGUILayout.EndHorizontal();
        }