Legacy Documentation: Version 5.0
Language: English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

FadeGroupScope

Namespace: UnityEditor

Switch to Manual

Description

Begins a group that can be be hidden/shown and the transition will be animated.

#pragma strict
public class MyWindow extends EditorWindow {
	var m_ShowExtraFields;
	var m_String;
	var m_Color = Color.white;
	var m_Number = 0;
	@MenuItem("Window/My Window")
	static function Init() {
		var window = MyWindowEditorWindow.GetWindow(MyWindow);
	}
	function OnEnable() {
		m_ShowExtraFields = new AnimBool(true);
		m_ShowExtraFields.valueChanged = Repaint;
	}
	function OnGUI() {
		m_ShowExtraFields.target = EditorGUILayout.ToggleLeft("Show extra fields", m_ShowExtraFields.target);
		var group = new EditorGUILayout.FadeGroupScope(m_ShowExtraFields.faded);
		{
			if (group.visible) {
				EditorGUI.indentLevel++;
				EditorGUILayout.PrefixLabel("Color");
				m_Color = EditorGUILayout.ColorField(m_Color);
				EditorGUILayout.PrefixLabel("Text");
				m_String = EditorGUILayout.TextField(m_String);
				EditorGUILayout.PrefixLabel("Number");
				m_Number = EditorGUILayout.IntSlider(m_Number, 0, 10);
				EditorGUI.indentLevel--;
			}
		}
	}
}

Variables

visibleWhether the group is visible.

Constructors

EditorGUILayout.FadeGroupScopeCreate a new FadeGroupScope and begin the corresponding group.