- Home /
Unity Editor - Create a custom scene view
Hi there,
I would like to know if it's possible to create a new 3D view in the editor. The aim is to preview an object with gizmos etc... without having to leave the actual scene. This shouls be displayed in an EditorWindow.
Thanks a lot !
Hello,
You can create a new RenderTexture and assign it to the targetTexture of your camera.
proof that it works:
using UnityEngine;
using System.Collections;
public class test : $$anonymous$$onoBehaviour {
public RenderTexture text ;
// Use this for initialization
void Start () {
text = new RenderTexture(400, 200, 200);
camera.targetTexture = text;
}
// Update is called once per frame
void Update () {
}
}
attach this script to the camera in a scene.
a RenderTexture Inherits from: Texture so it should not be a problem to display it as a GUI element
Thank you but this is not what I want. I would like to create a new scene view, like a preview window.
It is possible, but not very easy. You could use GUI.DrawTexture
to draw a RenderTexture
like @Nerevar mentioned. This texture will be used as the target texture of a temporary camera that you new up to preview your model or whatever. But then you'd have to detect panning etc which gets weird quickly.
Alternatively, I don't know if this works for you but you could create a new Scene 'tab' - Right click on the current open scene tab | Add tab | Scene.