|
Note -- click here Dear experts at programming the editor ... My problem, the "Layouts" system in Unity ...
... does not look after the sizes of windows. Would it be possible to program something that can set your window sizes? Can you access that info and move the windows around? Thanks! Note Incredibly, jspease has produced an astounding full solution for this, which he offers freely, enjoy his amazing code below.
(comments are locked)
|
|
This can mostly be done with editor classes, but there's a big problem due to a hole in the API: There's no way to dock a window from script code and there's no way to move a window without undocking it. But here's some code anyway: Note -- click here Yeah it displays that warning even if the code is still there too for me: I have to reselect the same layout a couple of times and then all of the windows work again, each time I start Unity.
Jun 15 '12 at 11:05 AM
whydoidoit
I updated the answer with support for the "main" window (so you can get and set windows.main.position). It's getting even further into undocumented territory though and doesn't work 100%. Note also that I purposely didn't support the case of multiple windows of the same type (such as two Inspector windows being open at the same time) but I think it's possible using the FindAll function to access the windows separately.
Jun 15 '12 at 07:28 PM
jspease
Also, by the way, I suspect that full docking support might be possible by using reflection to mess around with instances of the UnityEditor.ContainerWindow and maybe SplitView classes enough, to add editor windows as children of container windows.
Jun 15 '12 at 07:34 PM
jspease
Thank you so much. This was exactly what I was looking for!
Jun 18 '12 at 12:48 PM
CarlEmail
Wow, this totally saved me from pulling all my hair out! I've been trying to line up 3D elements with a GUI Layer background, but the locations of the 3D elements were changing between the Editor and the build. This was cuz my Game View wasn't showing my full 1080 x 1920 (portrait) resolution, even when maximized on a 1080p monitor. The Game View only goes up to 1903 pixels, likely due to the UI tabs at the top of the window. But i was able to use this script to cheat the top position of the Game View window up to -19 pixels, so the UI tab is off-screen, which at least puts the window the right position so that now my game object positions in the editor match the fullscreen build. So now i can correctly position things in the editor! Thanks much!
Feb 04 at 05:49 AM
madcalf
(comments are locked)
|


@jspease .. if you happen to see this message,
it appears something was changed in Unity4, and "Project" doesn't work. I'm really sorry to bother you! Only you know what you're doing on this, cheers! :)
http://answers.unity3d.com/questions/395202/editor-scripting-unity-4-problem-with-project-wind.html