|
Hi all, there's several variants of this question floating around, but this one, I haven't found a solution nor even an idea of how to solve. Basically, from an editor window, in editor mode, I have the need to retrieve the 'game window' current width and height. You might already know in fact that when you address screen.width or height from an editor window (the one created by an editor script), the values you receive are the dimensions of the actual editor window, and not of the game window! I can't possibly think that this issue can't be solved in editor mode, from an editor window, so please help me understand how to retrieve the game-window pixel dimensions in edit mode. Note: for a series of design requisites, I can't simply set the aspect to standalone, and a predetermined X-Y value, and stick with that, basically because these necessarily vary from development seat to seat. Thanks.
(comments are locked)
|
|
Unfortunately the Here's a similar case on how to access internal classes via reflection: http://answers.unity3d.com/questions/129694/can-you-turn-off-auto-keyframe-in-the-animation-wi.html But be careful! Those classes are internal and they can change them at any time. It's something you actually shouldn't use if you can avoid it. edit I've written a little helper function which will return the size of the main GameView: This is a great solution, thanks a lot. Additional value in your heads up regarding the internal classes usage.
Dec 07 '11 at 03:54 PM
roamcel
Hi @bunny83 is there a way through which i can set the resolution back..
Jun 26 '12 at 12:17 PM
flamy
@flamy: Set it back? to what? I don't change the resolution. This will just determine the size of the first gameview. It's generally a bad idea to set the size of any editor window via code, since this will most likely undock the window and break your layout. If you want to do this because you have your window already undocked, you can set the size and position for the gameview the same way as for any other Editorwindow. All you need is a reference to the gameview: untested: With this you should be able to use any Editorwindow properties like the position: Note that this will set the window's position, the actual view size could be a bit smaller due to the window border. There is no build in function to set it to a certain resolution. There is the internal function GetGameViewRect which calculates the view size depending on the window size, but not reverse ;)
Jun 27 '12 at 03:38 AM
Bunny83
(comments are locked)
|
(comments are locked)
|

Would love to see an answer to this one :P