Make sure the "Toggle skybox, fog and other effects." button in pressed on the Scene tab
This can help make sure that the Scene view and Game view look similar.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | using System; using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; public class FrameDump: MonoBehaviour { string folder = "C:\\temp\\cap"; [SerializeField] int frameCount = 60; int MAXFRAMES = 0; // Initialization void Start() { // delete folder (and anything inside it) if it exists if (System.IO.Directory.Exists(folder)) { System.IO.Directory.Delete(folder, true); } // create the folder for dumps System.IO.Directory.CreateDirectory(folder); MAXFRAMES = frameCount; } private void OnPostRender() { if (frameCount <= 0) return; string filename = string.Format("{0:000000}", (MAXFRAMES - frameCount)); Debug.Log("File: " + filename); //Create a new texture with the width and height of the screen Texture2D texture = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false); //Read the pixels in the Rect starting at 0,0 and ending at the screen's width and height texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0, false); texture.Apply(); File.WriteAllBytes(folder + "\\" + filename + ".png", texture.EncodeToPNG()); Destroy(texture); frameCount--; } } |
using System.Collections; using System.Collections.Generic; using UnityEngine; public class TakeScreenShot : MonoBehaviour { // Update is called once per frame void Update () { #if UNITY_EDITOR if (Input.GetKey(KeyCode.Z)) #else if((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Z)) #endif { Debug.Log("Taking screenshot"); ScreenCapture.CaptureScreenshot("ScreenShot-" + UnityEngine.SceneManagement.SceneManager.GetActiveScene().name + ".png"); Debug.Log("Done"); } } }
If windows starting is slow, to enable windows 11 fast startup/boot, Press Windows + R, type powercfg.cpl, and hit Enter. This will direct...