public override void OnInspectorGUI() { serializedObject.Update(); Inspector_Utils.DrawHeader(); GUILayout.Space(4); DrawCustomInspector(); if (GUI.changed) { EditorUtility.SetDirty(target); } }
public override void OnInspectorGUI() { if (m_Instance == null) { return; } Undo.RecordObject(target, "HVR Light"); GUI.color = editorColor; Inspector_Utils.DrawHeader(); GUILayout.Space(4); this.DrawDefaultInspector(); ExposeProperties.Expose(m_fields); Light dependentLight = m_Instance.GetComponent <Light>(); if (dependentLight != null && dependentLight.type == LightType.Directional) { #if UNITY_2017_1_OR_NEWER EditorGUI.BeginChangeCheck(); m_Instance.ShadowDistanceLimit = EditorGUILayout.Slider("Shadow Distance Limit", m_Instance.ShadowDistanceLimit, 0.1f, QualitySettings.shadowDistance); if (EditorGUI.EndChangeCheck()) { HvrEditorGUI.ForceRedrawHvrWorldAndRepaintView(); } #else EditorGUILayout.HelpBox("Casting shadows from directional lights is not supported in versions before Unity 2017.1.", MessageType.Warning); #endif } if (GUI.changed) { SceneView.RepaintAll(); EditorUtility.SetDirty(target); Repaint(); } }
public override void OnInspectorGUI() { if (s_Styles == null) { s_Styles = new Styles(); } serializedObject.Update(); Inspector_Utils.DrawHeader(); DrawFields(); serializedObject.ApplyModifiedProperties(); if (GUI.changed) { SceneView.RepaintAll(); EditorUtility.SetDirty(target); } }
public override void OnInspectorGUI() { serializedObject.Update(); Inspector_Utils.DrawHeader(); EditorGUILayout.BeginVertical(GUI.skin.GetStyle("HelpBox")); { EditorGUILayout.BeginVertical("box"); { EditorGUILayout.LabelField("Asset", EditorStyles.boldLabel); } EditorGUILayout.EndVertical(); EditorGUI.indentLevel++; { EditorGUILayout.LabelField("Data", EditorStyles.boldLabel); EditorGUI.indentLevel++; { hvrEditorGUI.ActorDataMode(targetActor, serializedObject); switch (targetActor.dataMode) { case HvrActor.eDataMode.reference: EditorGUILayout.HelpBox("Reference: Drag and drop a file or folder onto the data slot.\nThis reference will be autoamtically be exported when a build is created.", MessageType.None); break; case HvrActor.eDataMode.path: EditorGUILayout.HelpBox("Path: Enter a direct path to a file or folder located on disk.\nThis path will not be copied when a build is created.", MessageType.None); break; } switch (targetActor.dataMode) { case HvrActor.eDataMode.reference: hvrEditorGUI.ActorDataGuidObject(targetActor, serializedObject); break; case HvrActor.eDataMode.path: hvrEditorGUI.ActorDataPath(targetActor, serializedObject); break; } } EditorGUI.indentLevel--; EditorGUILayout.LabelField("Settings", EditorStyles.boldLabel); EditorGUI.indentLevel++; { EditorGUILayout.HelpBox("These settings will be applied when the asset is created", MessageType.None); targetActor.assetPlay = EditorGUILayout.Toggle("Play", targetActor.assetPlay); targetActor.assetLoop = EditorGUILayout.Toggle("Loop", targetActor.assetLoop); targetActor.assetSeekTime = EditorGUILayout.FloatField("Seek To", targetActor.assetSeekTime); } EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(GUI.skin.GetStyle("HelpBox")); { EditorGUILayout.BeginVertical("box"); { EditorGUILayout.LabelField("Rendering", EditorStyles.boldLabel); } EditorGUILayout.EndVertical(); EditorGUI.indentLevel++; { EditorGUILayout.LabelField("Style", EditorStyles.boldLabel); EditorGUI.indentLevel++; { hvrEditorGUI.RenderMethod(target, serializedObject); hvrEditorGUI.MaterialField(target, serializedObject); } EditorGUI.indentLevel--; EditorGUILayout.LabelField("Lighting", EditorStyles.boldLabel); EditorGUI.indentLevel++; { if (hvrEditorGUI.UseLighting(target, serializedObject)) { EditorGUI.indentLevel++; hvrEditorGUI.CastShadows(target, serializedObject); hvrEditorGUI.ReceiveShadows(target, serializedObject); EditorGUI.indentLevel--; } } EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(GUI.skin.GetStyle("HelpBox")); { EditorGUILayout.BeginVertical("box"); { EditorGUILayout.LabelField("Options", EditorStyles.boldLabel); } EditorGUILayout.EndVertical(); EditorGUI.indentLevel++; { hvrEditorGUI.HvrActorScreenspaceQuad(target, serializedObject); hvrEditorGUI.OcclusionCullingEnabled(target, serializedObject); if (targetActor.occlusionCullingEnabled) { EditorGUI.indentLevel++; { hvrEditorGUI.OcclusionCullingMultipler(target, serializedObject); } EditorGUI.indentLevel--; } } EditorGUI.indentLevel--; } EditorGUILayout.EndVertical(); if (targetActor.assetInterface != null) { hvrEditorGUI.AssetPlaybackBar(targetActor.assetInterface, serializedObject); } if (targetActor.material != null) { hvrEditorGUI.MaterialEditor(target, targetActor.material, serializedObject); } if (GUI.changed) { if (!Application.isPlaying) { UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(targetActor.gameObject.scene); } EditorUtility.SetDirty(target); SceneView.RepaintAll(); } }