Convert from EditorGUI to EditorGUILayout

Easy, but not everyone known,
key function is EditorGUILayout.GetControlRect(); it return the “Next” rect that will be used from your inspector.

public static string MyEditorGUILayout(string input)
{
	Rect rect = EditorGUILayout.GetControlRect();
	return MyEditorGUI(rect, input);
}

public static string MyEditorGUI(Rect position, string input)
{
	// draw your stuff with that "position".
}

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

*