Unity GUI and GetNameOfFocusedControl

Hi,

since this is my first post here, I really want to say how much I like Unity and admire your work! Really amazing, thumbs up!! I am on my way to learn it, mostly via experimenting :slight_smile:

However, while experimenting, I stumbled on something - namely the how GUI handles named elements creation. I have also searched a bit here and red those tho threads:

http://forum.unity3d.com/threads/188202-Simple-dynamic-list-editor?p=1327207#post1327207

My problem is the following: in the OnGUI function (Javascript) I use classes, which encapsulate my “views” creation, having one “controller” to switch them and data holder classes for each view, which sounds like a clean mvc pattern… however I noticed, like others here, that when I switch the views, Unity does not return properly the name of the currently focused element any more. I have tried the suggestions from the threads above, namely to do the switch not in the OnGUI directly, but to queue it and do it in the Update function - this seems not to help in my case.

I am using different names for the controls in each view, so there is no “myTextField” for two TextFields in different views, I have also tried to call GUI.UnfocusWindow() on every view switch and additionally in the Update function - this also seems not to help much.

Slowly I am out of ideas… any help?
Thank you!

Edit: correction, seems not to be my first post, but first question.

Sooo… anyone?

I would expect, that at least GUI.UnfocusWindow() clears the currently focused/cashed element?