public void Destroy() { #if DEBUG if (behaviourGmo) { GameObject.Destroy(behaviourGmo); } if (renderTextureBuffer != null) { renderTextureBuffer.Dispose(); } renderTextureBuffer = null; #endif }
private void InitializeLogic(int width, int height) { #if DEBUG renderTextureBuffer = new ScreenShotLogic(width, height); var behaviourGmo = new GameObject(); behaviourGmo.hideFlags = HideFlags.HideAndDontSave; GameObject.DontDestroyOnLoad(behaviourGmo); var behaviour = behaviourGmo.AddComponent <ScreenShotBehaviour>(); this.captureSampler = CustomSampler.Create("ScreenshotToProfiler.Capture"); this.updateSampler = CustomSampler.Create("ScreenshotToProfiler.Update"); behaviour.captureFunc += this.Capture; behaviour.updateFunc += this.Update; #endif }