- Home /
Viewpport for Custom Editor
Hello, how might one mimic something like the level editors viewport in a custom editor window. However, the user would not be viewing the level, but perhaps a prefab with different components like renderers, animation, particles, etc?
I've seen people ask for how to create a preview window. This is not really what I mean. Some kind of window that you could edit the object you are seeing.
I would greatly appreciate anyone who could point me to some literature or maybe some code examples. I really want to learn how this would work, if it is possible.
Answer by Paulius-Liekis · Sep 16, 2014 at 10:13 PM
If I had to do it I would render the scene (i.e. prefabs, paticles, whatnot) into a RenderTexture and then simply display that Texture on a custom window. After that you just need to add all mouse interaction to your custom window. So yeah, read about RenderTexture, EditorWindow classes and OnGUI method. I hope that gives you a good start.
I was thinking about render texture, but I was wondering more so about how would you preview the prefab with out it being in the scene, so not using an existing game object with camera component to render. Say you selected it in the projects folder and then the custom editor window would show a viewport of the prefab.
Is it possible to even have a viewport that is independent from the scene and its view?
Your answer
Follow this Question
Related Questions
reconnect programmatically instantiated prefab 1 Answer
Editor Window Views 0 Answers
Print to status bar. 0 Answers
Custom Editor - Is there any way to detect whether the user is in Prefab editing mode? 1 Answer
Set MinWidth for EditorWindow 1 Answer