// Returns the first EditorWindow of type /t/ which is currently on the screen. static EditorWindow GetWindowWithRectPrivate(System.Type t, Rect rect, bool utility, string title) { UnityEngine.Object[] wins = Resources.FindObjectsOfTypeAll(t); EditorWindow win = wins.Length > 0 ? (EditorWindow)(wins[0]) : null; if (!win) { win = ScriptableObject.CreateInstance(t) as EditorWindow; win.minSize = new Vector2(rect.width, rect.height); win.maxSize = new Vector2(rect.width, rect.height); win.position = rect; if (title != null) { win.titleContent = new GUIContent(title); } if (utility) { win.ShowUtility(); } else { win.Show(); } } else { win.Focus(); } return(win); }
private static EditorWindow GetWindowWithRectPrivate(Type t, Rect rect, bool utility, string title) { UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll(t); EditorWindow editorWindow = (array.Length <= 0) ? null : ((EditorWindow)array[0]); if (!editorWindow) { editorWindow = (ScriptableObject.CreateInstance(t) as EditorWindow); editorWindow.minSize = new Vector2(rect.width, rect.height); editorWindow.maxSize = new Vector2(rect.width, rect.height); editorWindow.position = rect; if (title != null) { editorWindow.titleContent = new GUIContent(title); } if (utility) { editorWindow.ShowUtility(); } else { editorWindow.Show(); } } else { editorWindow.Focus(); } return(editorWindow); }
public static UnityEditor.EditorWindow ViewInInspectorInstance(UnityEngine.Object viewTarget, UnityEditor.EditorWindow inspectorInstance = null) { var inspectorType = typeof(UnityEditor.Editor).Assembly.GetType("UnityEditor.InspectorWindow"); if (inspectorInstance == null) { inspectorInstance = ScriptableObject.CreateInstance(inspectorType) as UnityEditor.EditorWindow; } if (inspectorInstance.GetType() != inspectorType) { throw new System.NotImplementedException(); } inspectorInstance.Show(); System.Reflection.BindingFlags bindingFlags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public; System.Reflection.MethodInfo isLockedMethodInfo = inspectorType.GetProperty("isLocked", bindingFlags).GetSetMethod(); isLockedMethodInfo.Invoke(inspectorInstance, new object[] { false }); //解除InspectorLock var prevSelection = UnityEditor.Selection.objects; //記錄前一個選擇的物件 UnityEditor.Selection.objects = new UnityEngine.Object[] { viewTarget }; //選擇viewTarget讓Inspector刷新 isLockedMethodInfo.Invoke(inspectorInstance, new object[] { true }); //Inspector Lock UnityEditor.Selection.objects = prevSelection; //重新選擇前一個物件,當作什麼都沒發生 return(inspectorInstance); }
internal void Reload(object userData) { EditorWindow editorWindow = userData as EditorWindow; if (!(editorWindow == null)) { Type type = editorWindow.GetType(); string json = EditorJsonUtility.ToJson(editorWindow); DockArea dockArea = editorWindow.m_Parent as DockArea; if (dockArea != null) { int idx = dockArea.m_Panes.IndexOf(editorWindow); dockArea.RemoveTab(editorWindow, false); UnityEngine.Object.DestroyImmediate(editorWindow, true); editorWindow = (ScriptableObject.CreateInstance(type) as EditorWindow); dockArea.AddTab(idx, editorWindow); } else { editorWindow.Close(); editorWindow = (ScriptableObject.CreateInstance(type) as EditorWindow); if (editorWindow != null) { editorWindow.Show(); } } EditorJsonUtility.FromJsonOverwrite(json, editorWindow); } }
static void Init() { UnityEditor.EditorWindow window = GetWindow(typeof(BrokenSubEmitterSetup), false, "SubEmitter"); window.minSize = new Vector2(400, 100); window.maxSize = new Vector2(400, 100); window.position = new Rect(300, 300, 400, 100); window.Show(); }
static void Init() { UnityEditor.EditorWindow window = GetWindow(typeof(PaletteGenerator)); const int width = 500; const int height = 500; Vector2 size = new Vector2(width, height); window.minSize = size; window.position = new Rect(0, 0, width, height); window.Show(); }
static void Init() { // Get existing open window or if none, make a new one: UnityEditor.EditorWindow window = GetWindow(typeof(ShirtStandalone)); //Show the window when it is called on window.minSize = new Vector2(360, 1100); window.Show(); /*if (!(AssetDatabase.IsValidFolder ("UMC_Assets"))) { * WebClient client = new WebClient(); * client.DownloadFile (url, Application.persistentDataPath + "/" + "Shirt.unitypackage"); * }*/ }
// Returns the first EditorWindow of type /t/ which is currently on the screen. static EditorWindow GetWindowPrivate(System.Type t, bool utility, string title, bool focus) { UnityEngine.Object[] wins = Resources.FindObjectsOfTypeAll(t); EditorWindow win = wins.Length > 0 ? (EditorWindow)(wins[0]) : null; if (!win) { try { win = ScriptableObject.CreateInstance(t) as EditorWindow; if (title != null) { win.titleContent = new GUIContent(title); } if (utility) { win.ShowUtility(); } else { win.Show(); } } catch { win.Close(); throw; } } else if (focus) { win.Show(); // For some corner cases in saved layouts, the window can be in an unvisible state. // Since the caller asked for focus, it's fair to assume he wants it always to be visible. (case 586743) win.Focus(); } return(win); }
internal void Reload(object userData) { EditorWindow window = userData as EditorWindow; if (window == null) { return; } // Get some info on the existing window. Type windowType = window.GetType(); // Save what we can of the window. string windowJson = EditorJsonUtility.ToJson(window); DockArea dockArea = window.m_Parent as DockArea; if (dockArea != null) { int windowIndex = dockArea.m_Panes.IndexOf(window); // Destroy window. dockArea.RemoveTab(window, false); // Don't kill dock if empty. DestroyImmediate(window, true); // Create window. window = EditorWindow.CreateInstance(windowType) as EditorWindow; dockArea.AddTab(windowIndex, window); } else { // Close the existing window. window.Close(); // Recreate window. window = EditorWindow.CreateInstance(windowType) as EditorWindow; if (window != null) { window.Show(); } } // Restore what we can of the window. EditorJsonUtility.FromJsonOverwrite(windowJson, window); }
void InstantiatePrimitive(TipoObjetivo op) { switch (op) { case TipoObjetivo.uniTargetEnemy: GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube); cube.transform.position = Vector3.zero; break; case TipoObjetivo.uniTargetAlly: GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere); sphere.transform.position = Vector3.zero; break; case TipoObjetivo.allEnemies: GameObject plane = GameObject.CreatePrimitive(PrimitiveType.Plane); plane.transform.position = Vector3.zero; break; case TipoObjetivo.allAllies: GameObject plane2 = GameObject.CreatePrimitive(PrimitiveType.Plane); plane2.transform.position = Vector3.zero; break; case TipoObjetivo.allMap: GameObject plane3 = GameObject.CreatePrimitive(PrimitiveType.Plane); plane3.transform.position = Vector3.zero; break; case TipoObjetivo.area: if (!ventanaAbierta) { ventanaAbierta = true; UnityEditor.EditorWindow window = new UnityEditor.EditorWindow(); window.Show(); } break; default: Debug.LogError("Unrecognized Option"); break; } }
static void Init() { UnityEditor.EditorWindow window = GetWindow(typeof(GetTransformWindow)); window.Show(); }
static void Init() { UnityEditor.EditorWindow window = GetWindow(typeof(Terrainoise)); window.Show(); }
static void init() { UnityEditor.EditorWindow window = GetWindow(typeof(WindowsEditorBullet)); window.Show(); }
static void Init() { UnityEditor.EditorWindow window = GetWindow(typeof(EnumPopTest)); window.Show(); }
static void Init() { UnityEditor.EditorWindow window = GetWindow(typeof(TagsEditor), true); window.CenterOnMainWin(); window.Show(); }
static void Init() { UnityEditor.EditorWindow window = GetWindow(typeof(ClothesCreator)); window.Show(); }
static void Init() { UnityEditor.EditorWindow window = GetWindow(typeof(GetIntrinsicsWindow)); window.Show(); }
private static void ShowWindowImmediate(EditorWindow win) { win.Show(true); }
static void Init() { UnityEditor.EditorWindow window = GetWindow(typeof(mapSceneGenerator)); window.position = new Rect(0, 0, 250, 80); window.Show(); }
static protected void Initialize<W>(string i_windowName) { UnityEditor.EditorWindow window = GetWindow(typeof(W), false, i_windowName); window.Show(); }