- Home /
Disable input to inspector drawn underneath
Hi, i am doing custom window where i draw my own windows with some objects inspectors. My problem now is to block input to the inspector that is drawn underneath other one. Now when my windows overlap on each other inspector below is taking mouse input very often. Like i have two float fields overlap and when i click on top one, the one from below is getting focus. I tried GUI.depth but it seems not to have any impact. Any ideas?
Thanks in advance, cheers
Good day.
I dont get exatcly whats your problem?
You have 2 canvas elements in overlaping and need one to block clicks on what is behind it?
I have one custom editor window. In this window i am drawing rectangles with GL (ala windows), and inside of those rectangles i am drawing default or custom inspectors of some scriptable objects. Those rectangles are movable with mouse drag. When i move one rectangle over another their fields from inspector overlaps (one is drawn on top of another). I need a way to say that when i click on some field the very top field in this position will get focus (the one which is on top of others) (i am doing something like blueprints in UnrealEngine)
Here is a screenshot of what i mean.
When my "windows" overlaps and i click on overlaping fields (red dot) the one from bottom will be focused. I need it to be one from the top.
I think it is about drawing queue. The click event on field will be consumed by inspector that is drawn first (on bottom, behind everything). Is there any way to deal with it?
I've been struggling with this myself somewhat recently and sadly haven't found any good way to fix it. So I just kinda moved on and did my stuff differently, heh... I'd be interested to see an answer though if someone knows.
Answer by Bunny83 · Jul 16, 2018 at 09:12 AM
You said you're
doing custom window
You know that the IMGUI actually has a Window method? The main point of this is to allow overlapping GUI areas. Since we have no idea how you've implemented your own solution we can't really help you. The IMGUI is an immediate mode GUI. That means everything happens immediately in the order you specified. The drawing order is also the order in which the controls are processed for input. GUI.Window / GUILayout.Window are seperate sub sections. Since they are drawn through a callback Unity can process all windows "forward" when repainting and "backwards" when processing input.
Your answer
Follow this Question
Related Questions
Should I use Inspector or custom editor window? 1 Answer
Calling a custom inspector from an editor window of an instance of a class 1 Answer
How to limit an ObjectField to assets with specific file extension 2 Answers
changing value of child objects in root object not persistent? 0 Answers
Is there any way to hide the "Object picker" of an EditorGUILayout.ObjectField ? 2 Answers