public static IEnumerator CaptureScreenToTextureCoroutine(UnityAction <Texture2D> onTextureCaptured = null,
                                                                  ScreenshotTaker.ColorFormat colorFormat   = ScreenshotTaker.ColorFormat.RGB)
        {
            yield return(new WaitForEndOfFrame());

            var texture = ScreenshotTaker.CaptureScreenToTexture(colorFormat);

            onTextureCaptured(texture);
        }
 protected void InitScreenshotTaker()
 {
     m_ScreenshotTaker = GameObject.FindObjectOfType <ScreenshotTaker> ();
     if (m_ScreenshotTaker == null)
     {
         m_ScreenshotTaker = gameObject.GetComponent <ScreenshotTaker> ();
     }
     if (m_ScreenshotTaker == null)
     {
         m_ScreenshotTaker = gameObject.AddComponent <ScreenshotTaker> ();
     }
 }
        static void InitScreenshotTaker()
        {
            if (m_ScreenshotTaker != null)
            {
                return;
            }

            if (m_ScreenshotTaker == null)
            {
                GameObject go = new GameObject();
                go.name           = "tmp Screenshot Capture";
                m_ScreenshotTaker = go.AddComponent <ScreenshotTaker> ();
            }
        }
Beispiel #4
0
        protected void InitScreenshotTaker()
        {
            if (m_ScreenshotTaker == null)
            {
                m_ScreenshotTaker = GameObject.FindObjectOfType <ScreenshotTaker>();
            }
            if (m_ScreenshotTaker == null)
            {
                m_ScreenshotTaker = gameObject.GetComponent <ScreenshotTaker>();
            }
            if (m_ScreenshotTaker == null)
            {
                m_ScreenshotTaker = gameObject.AddComponent <ScreenshotTaker>();
            }

            m_ScreenshotTaker.m_GameViewResizingWaitingMode   = m_Config.m_GameViewResizingWaitingMode;
            m_ScreenshotTaker.m_GameViewResizingWaitingFrames = m_Config.m_ResizingWaitingFrames;
            m_ScreenshotTaker.m_GameViewResizingWaitingTime   = m_Config.m_ResizingWaitingTime;
        }
Beispiel #5
0
        void InitTempManager()
        {
            if (m_Manager != null)
            {
                return;
            }

            GameObject obj = new GameObject();

            obj.name = "Temporary screenshot manager - remove if still exists in scene in edit mode.";

            // First we create the screenshot taker
            m_ScreenshotTaker = obj.AddComponent <ScreenshotTaker> ();
            m_ScreenshotTaker.m_GameViewResizingWaitingMode   = m_ConfigAsset.m_Config.m_GameViewResizingWaitingMode;
            m_ScreenshotTaker.m_GameViewResizingWaitingFrames = m_ConfigAsset.m_Config.m_ResizingWaitingFrames;
            m_ScreenshotTaker.m_GameViewResizingWaitingTime   = m_ConfigAsset.m_Config.m_ResizingWaitingTime;

            // Then the manager
            m_Manager          = obj.AddComponent <ScreenshotManager> ();
            m_Manager.m_Config = m_ConfigAsset.m_Config;
            m_Manager.Awake();
        }
Beispiel #6
0
        public virtual IEnumerator CaptureCoroutine(ScreenshotResolution desiredCaptureResolution,
                                                    List <ScreenshotCamera> cameras,
                                                    List <ScreenshotOverlay> overlays,
                                                    ScreenshotTaker.CaptureMode captureMode,
                                                    int antiAliasing   = 8,
                                                    bool captureGameUI = true,
                                                    ScreenshotTaker.ColorFormat colorFormat = ScreenshotTaker.ColorFormat.RGB,
                                                    bool recomputeAlphaMask = false,
                                                    bool stopTime           = false,
                                                    bool restore            = true)
        {
            m_ScreenshotTaker = GameObject.FindObjectOfType <ScreenshotTaker> ();

            // Capture all inner textures
            foreach (RawImage texture in m_Textures)
            {
                yield return(m_ScreenshotTaker.StartCoroutine(CaptureInnerTextureCoroutine(texture, desiredCaptureResolution, cameras, overlays, captureMode, antiAliasing, captureGameUI, colorFormat, recomputeAlphaMask, stopTime)));
            }

            // Capture the composition at the desired resolution size
            yield return(m_ScreenshotTaker.StartCoroutine(CaptureCompositionCoroutine(desiredCaptureResolution)));
        }
 /// <summary>
 /// Captures cameras to a texture.
 /// </summary>
 public static Texture2D CaptureCamerasToTexture(int width, int height, List <Camera> cameras, ScreenshotTaker.ColorFormat colorFormat = ScreenshotTaker.ColorFormat.RGB)
 {
     return(ScreenshotTaker.CaptureCamerasToTexture(width, height, cameras, colorFormat));
 }