Convert from EditorGUI to EditorGUILayout

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".
}

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

*

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料