言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

EditorGUILayout.BeginFadeGroup

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function BeginFadeGroup(value: float): bool;
public static bool BeginFadeGroup(float value);
public static def BeginFadeGroup(value as float) as bool

Parameters

value A value between 0 and 1, 0 being hidden, and 1 being fully visible.

Description

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

Returns if the group is visible or not.

using UnityEngine;

using UnityEditor;

using UnityEditor.AnimatedValues;



public class MyWindow : EditorWindow {



	AnimBool m_ShowExtraFields;

	string m_String;

	Color m_Color = Color.white;

	int m_Number = 0;



	[MenuItem("Window/My Window")]

	static void Init()

	{

		MyWindow window = (MyWindow)EditorWindow.GetWindow (typeof (MyWindow));

	}



	void OnEnable(){

		m_ShowExtraFields = new AnimBool(true);

		m_ShowExtraFields.valueChanged = Repaint;

	}



	void OnGUI () {

		m_ShowExtraFields.target = EditorGUILayout.ToggleLeft("Show extra fields", m_ShowExtraFields.target);



		//Extra block that can be toggled on and off.

		if (EditorGUILayout.BeginFadeGroup(m_ShowExtraFields.faded))

		{

			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--;

		}

		EditorGUILayout.EndFadeGroup();

	}

}