Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

[solved]How to get the size of EditorWindow?

Discussion in 'Extensions & OnGUI' started by h.istvan, Jan 18, 2010.

  1. h.istvan

    h.istvan

    Joined:
    Aug 4, 2009
    Posts:
    77
    Hello!
    Recently I started to write a custom Editor script in C#,and I want to place buttons, that stick to the bottom-right side of the window even on resizing.
    My problem is that I don't know how to get the width and the height of the window.
    Any good idea?
     
  2. matthewminer

    matthewminer

    Joined:
    Aug 29, 2005
    Posts:
    320
    Use EditorWindow.position to get your window's Rect, which you can get the width and height of.

    Code (csharp):
    1. void OnGUI () {
    2.     Debug.Log("Window width: " + position.width);
    3. }
     
  3. h.istvan

    h.istvan

    Joined:
    Aug 4, 2009
    Posts:
    77
    Thank you very much, it is exactly what I was looking for! :wink:
     
    TaleOf4Gamers likes this.
  4. hankchen

    hankchen

    Joined:
    Sep 18, 2014
    Posts:
    2
    thanks