- Home /
GUI.DragWindow() Refuses to work
I'm not entirely sure what I'm doing wrong, as everything in my code looks right, but I can't seem to get GUI.DragWindow() to work... If anyone could tell me what I'm doing wrong, I would greatly appreciate it.
using UnityEngine;
using System.Collections;
public class Interface : MonoBehaviour {
Rect statusWindow = new Rect(15,15,300,300);
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI()
{
GUI.Window (0,statusWindow,StatusWindow,"Status");
}
void StatusWindow(int windowID)
{
GUI.DragWindow(new Rect(0,0,10000,10000));
}
}
Bumping because I need help and I don't want this to get buried. Surely someone out there knows why this isn't working...
Answer by numberkruncher · May 27, 2013 at 08:33 PM
GUI.Window
returns the new position for the window, you are merely forcing the window to appear in the same position all of the time. To fix your issue simply change your line to the following:
statusWindow = GUI.Window(0, statusWindow, StatusWindow, "Status");
Edit: You can also just call GUI.DragWindow()
with no other parameters.
Your answer
Follow this Question
Related Questions
Dragwindow can only be called within a window callback 1 Answer
GUI.Window makes custom EditorWindow drag header unresponsive 2 Answers
How do you prevent GUI.DragWindow from letting the window go offscreen? 2 Answers
GUI DragWindow only working for a single window. 0 Answers
GUI.DragWindow() dont work in C# (Unity 4.2), Java works? 2 Answers