Legacy Documentation: Version 5.5
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

EditorWindow.autoRepaintOnSceneChange

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public var autoRepaintOnSceneChange: bool;
public bool autoRepaintOnSceneChange;

Description

Does the window automatically repaint whenever the scene has changed?


Editor Window that renders what the main camera is "seeing".

no example available in JavaScript
// Simple script that lets you render the main camera in an editor Window.

using UnityEngine; using UnityEditor;

public class CameraViewer : EditorWindow { Camera camera = Camera.main; RenderTexture renderTexture;

[MenuItem("Example/Camera viewer")] static void Init() { EditorWindow editorWindow = GetWindow(typeof(CameraViewer)); editorWindow.autoRepaintOnSceneChange = true; editorWindow.Show(); } public void Awake () { renderTexture = new RenderTexture((int)position.width, (int)position.height, (int)RenderTextureFormat.ARGB32 ); } public void Update() { if(camera != null) { camera.targetTexture = renderTexture; camera.Render(); camera.targetTexture = null; } if(renderTexture.width != position.width || renderTexture.height != position.height) renderTexture = new RenderTexture((int)position.width, (int)position.height, (int)RenderTextureFormat.ARGB32 ); } void OnGUI() { GUI.DrawTexture( new Rect( 0.0f, 0.0f, position.width, position.height), renderTexture ); } }