- Home /
Rendering a camera to an Editor Window
Hello,
I've been trying to set up an Editor Window that mimics the default Scene View with a few extra project related features, similar to a middleware solution. To do this, it needs to render a camera created and hidden with hide flags to the window, and then have additional details drawn in relation to specific points in the scene.
I've done this by using Handles, but the documentation for this class is both deprecated and not very descriptive. I've got it rendering properly and all of the extra features functioning, but there is a major crippling bug.
The camera does not render with a depth buffer, so objects are "randomly" drawn over other objects. I don't think its a problem with how I'm using the Handles class, because when I try directly calling .Render() from the camera it still rendering incorrectly. I've commented out all of my other code when I do this, so I am sure it is nothing I have done wrong, but more what I'm not doing.
Here's what I've found out from trying to debug this problem over the last few days:
- The camera itself is fine, if I don't hide it with hide flags and view the preview in the default Scene View, it renders correctly.
- The scene can be renderred correctly with a Render Texture, but what I'm working on has to be usable on an Indie version of Unity (I myself have a Pro License). I am also in doubt some of the required features will work in conjunction with Render Textures.
- It's nothing wrong in my code, as I've tried rendering in an empty class with no adjoining code seperately to my main Editor Window, so it has to be a limitation of the editor scripting or something that I'm not doing (like telling it to render with depth).
Does anyone have any experience with this type of problem? I haven't been able to find any related questions posted on the site, besides these:
http://answers.unity3d.com/questions/24070/debug-rendering-using-the-depth-buffer
These were the closest I found and neither helped solve the problem. So either my problem is really simple (probably), or not many people are doing this (less likely).
Thanks.
Same problem; though I tried using non-Pro version of Unity. It seems to ignore the depth buffer entirely, however if you select the camera the preview window in scene view is correct...
I am very keen for an answer of this question because it is holding me back atm. $$anonymous$$y extension must too work with both pro and non-pro versions of Unity :)
Answer by vlevykin · Jan 01, 2013 at 05:11 PM
How do you render? I use Handles.DrawCamera and had similar depth problem. Somehow setting drawMode to Textured helped me. But could somebody explain this?
Answer by scanzy · Oct 16, 2015 at 03:18 PM
With Unity 5 now RenderTexture is FREE, so everything turns out to be so much easier!
http://unity3d.com/support/documentation/Components/class-RenderTexture.html
Your answer
Follow this Question
Related Questions
Issues with Handles not being at a right position 0 Answers
Drawing Handles 1 Answer
Editor scene preview window 0 Answers
Scene Box/Rectangle Editor. Does one exist? 0 Answers
Strange Handle names. 0 Answers