private void OnGUI() { if (selectedReadme != null) { Readme copy = UnityEngine.Object.Instantiate(selectedReadme) as Readme; copy.Style = ReadmeDisplayStyle.Window; var editor = Editor.CreateEditor(copy); editor.OnInspectorGUI(); //GUILayout.TextField("!= null" ); } else { GUILayout.TextField("== null"); } }
public static void ShowWindowForSelectedReadme(Readme rm) { selectedReadme = (Readme)rm; ShowWindow(); }
// private void OnGUI() // { // if (selectedReadme != null) // { // Readme copy = UnityEngine.Object.Instantiate(selectedReadme) as Readme; // copy.Style = ReadmeDisplayStyle.Window; // var editor = Editor.CreateEditor(copy); // editor.OnInspectorGUI(); // //GUILayout.TextField("!= null" ); // } // else // { // GUILayout.TextField("== null"); // } // } private void OnGUI() { if (selectedReadme != null) { // Readme copy = UnityEngine.Object.Instantiate(selectedReadme) as Readme; // copy.Style = ReadmeDisplayStyle.Window; // var editor = Editor.CreateEditor(copy); // editor.OnInspectorGUI(); Readme readme = selectedReadme; Init(); if (readme.sections != null) { EditorGUILayout.BeginVertical(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); foreach (var section in readme.sections) { #region DefineOrderVariables bool referensesAtTop = false; #region Logic if (section.assetReferences != null) { if (section.ShowRefsBeforeText) { referensesAtTop = true; } } #endregion #endregion if (!string.IsNullOrEmpty(section.heading)) { GUILayout.Label(section.heading, HeadingStyle); } if (referensesAtTop) { ShowRefs(section.assetReferences); if (!string.IsNullOrEmpty(section.text)) { GUILayout.Label(section.text, BodyStyle); } } else { if (!string.IsNullOrEmpty(section.text)) { GUILayout.Label(section.text, BodyStyle); } ShowRefs(section.assetReferences); } if (section.CheckMarks != null) { foreach (var cm in section.CheckMarks) { cm.Value = GUILayout.Toggle(cm.Value, cm.Text); } } if (!string.IsNullOrEmpty(section.linkText)) { if (LinkLabel(new GUIContent(section.linkText))) { Application.OpenURL(section.url); } } GUILayout.Space(kSpace); } EditorGUILayout.EndScrollView(); EditorGUILayout.EndHorizontal(); } if (readme.prefabForPreview != null) { var pf = readme.prefabForPreview; var img = AssetPreview.GetAssetPreview(pf); //EditorGUI.DrawPreviewTexture(position, img); GUILayout.Label(img, GUILayout.Width(img.width), GUILayout.Height(img.height)); } if (Event.current.type == EventType.MouseDown && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition)) { Debug.Log("Pressing prefab"); } } }