public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { SerializedProperty propSourceType = property.FindPropertyRelative("sourceType"); EditorGUILayout.PropertyField(propSourceType); if (propSourceType.enumValueIndex == 0) { EditorGUILayout.PropertyField(property.FindPropertyRelative("mediaPath")); MediaPathDrawer.ShowBrowseButton(property.FindPropertyRelative("mediaPath")); } else { //EditorGUILayout.PropertyField(property.FindPropertyRelative("texture")); //EditorGUILayout.PropertyField(property.FindPropertyRelative("textureDuration")); } EditorGUILayout.Space(); //EditorGUILayout.PropertyField(property.FindPropertyRelative("stereoPacking")); //EditorGUILayout.PropertyField(property.FindPropertyRelative("alphaPacking")); EditorGUILayout.Space(); EditorGUILayout.PropertyField(property.FindPropertyRelative("loop")); EditorGUILayout.PropertyField(property.FindPropertyRelative("startMode")); SerializedProperty propProgressMode = property.FindPropertyRelative("progressMode"); EditorGUILayout.PropertyField(propProgressMode); if (propProgressMode.enumValueIndex == (int)PlaylistMediaPlayer.ProgressMode.BeforeFinish) { EditorGUILayout.PropertyField(property.FindPropertyRelative("progressTimeSeconds")); } EditorGUILayout.Space(); SerializedProperty propIsOverrideTransition = property.FindPropertyRelative("isOverrideTransition"); EditorGUILayout.PropertyField(propIsOverrideTransition, _guiTextOverrideTransition); if (propIsOverrideTransition.boolValue) { EditorGUI.indentLevel++; SerializedProperty propTransitionMode = property.FindPropertyRelative("overrideTransition"); EditorGUILayout.PropertyField(propTransitionMode, _guiTextTransition); if (propTransitionMode.enumValueIndex != (int)PlaylistMediaPlayer.Transition.None) { EditorGUILayout.PropertyField(property.FindPropertyRelative("overrideTransitionDuration"), _guiTextDuration); EditorGUILayout.PropertyField(property.FindPropertyRelative("overrideTransitionEasing"), _guiTextEasing); } EditorGUI.indentLevel--; } }
public override void OnInspectorGUI() { //MediaPlayer media = (this.target) as MediaPlayer; //this.DrawDefaultInspector(); serializedObject.Update(); GUILayout.Label("Media Reference"); EditorGUILayout.Space(); //EditorGUILayout.PropertyField(_propAlias); //EditorGUILayout.Space(); { string mediaName = _propMediaPath.FindPropertyRelative("_path").stringValue; GUILayout.BeginVertical(GUI.skin.box); MediaPlayerEditor.OnInspectorGUI_CopyableFilename(mediaName); GUILayout.EndVertical(); } EditorGUILayout.PropertyField(_propMediaPath); MediaPathDrawer.ShowBrowseButton(_propMediaPath); EditorGUILayout.Space(); //GUILayout.Label("Media Hints", EditorStyles.boldLabel); EditorGUILayout.PropertyField(_propHints); EditorGUILayout.PropertyField(_propPlatformMacOS, new GUIContent("macOS")); EditorGUILayout.PropertyField(_propPlatformWindows, new GUIContent("Windows")); EditorGUILayout.PropertyField(_propPlatformAndroid, new GUIContent("Android")); EditorGUILayout.PropertyField(_propPlatformIOS, new GUIContent("iOS")); EditorGUILayout.PropertyField(_propPlatformTvOS, new GUIContent("tvOS")); EditorGUILayout.PropertyField(_propPlatformWindowsUWP, new GUIContent("UWP")); EditorGUILayout.PropertyField(_propPlatformWebGL, new GUIContent("WebGL")); EditorGUILayout.Space(); EditorGUILayout.Space(); serializedObject.ApplyModifiedProperties(); bool beginGenerateThumbnails = false; GUILayout.FlexibleSpace(); EditorGUI.BeginDisabledGroup(IsGeneratingThumbnails()); GUILayout.BeginHorizontal(); _thumbnailTime = GUILayout.HorizontalSlider(_thumbnailTime, 0f, 1f, GUILayout.ExpandWidth(true)); _zoomToFill = GUILayout.Toggle(_zoomToFill, "Zoom And Crop", GUI.skin.button, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (GUILayout.Button("Generate Thumbnail")) { beginGenerateThumbnails = true; } EditorGUI.EndDisabledGroup(); if (beginGenerateThumbnails) { BeginGenerateThumbnails(); } if (IsGeneratingThumbnails()) { ShowProgress(); } if (!IsGeneratingThumbnails()) { RemoveProgress(); } }