Window info

Is there a way to know when a window becomes active ? or if its active at the moment ? both help me with my problem…

.org

here is what I do:

using UnityEngine;
using System.Collections;

public class moviePlay : MonoBehaviour {

private Rect WindowRect;
private bool WindowActive;
private MovieTexture videoTexture;
public GUISkin videoController;
public GUISkin blankSkin;
public Texture2D playButton;
public Texture2D stopButton;
public Texture2D rewindButton;

	// Use this for initialization
	void Start () {
		
	WindowRect = new Rect(20, 20, 160,86);
	}
	
	
	void OnGUI()
	{
		
		if(WindowActive)
		{
			WindowRect = GUI.Window (1, WindowRect, VideoController, "Video Controller");
			WindowActive = true;
			videoTexture = (MovieTexture) renderer.material.mainTexture;		  	
		}
				
	}	
	
	void VideoController(int WindowId)
	{
		            		
		
		GUI.skin = videoController;
		
		GUILayout.BeginHorizontal();

		if(GUILayout.Button(playButton)) playVideo();
		if(GUILayout.Button(stopButton)) stopVideo();
		if(GUILayout.Button(rewindButton)) rewindVideo();
		
		GUILayout.EndHorizontal();
		
		GUI.skin = blankSkin;
		
		if(GUILayout.Button("hide panel")) 
		{
			
			videoTexture.Stop();
			WindowActive = false;						
		}
		
	      	GUI.DragWindow();
	}
	
	void playVideo()
	{
		videoTexture.Play();
	}
	
	void stopVideo()
	{
		videoTexture.Stop();
	}
	
	void rewindVideo()
	{
		videoTexture.Stop();
		videoTexture.Play();	
	}
	
	void OnMouseDown()
	{
		if(!WindowActive)	WindowActive = true;
	}
		
}

This is just a simple video controller GUI panel that appears when the video screen (plane with movieTexture) is clicked. It has a hide panel button to turn it off. Not sure if that’s what you mean or not.

Not really, when i have more than 1 GUI.Window that are being rendered, i want to know which one is being rendered as Active, the GUI.Window becomes Active when the user clicks his area or any control inside it.

.org

just guessing but it is possible to check for FocusWindow somehow?

I cant find anything like that, GUI.FocusWindow only lets you set the current GUI.Window with focus but does not return any value.

Sounds like a wish

.org