///////////////////////////////////////////////////////////////////////////////// public void Destroy() { _Panels.Remove(_rendererId); if (IsRenderToTexture) { UnityEngine.Object.Destroy(_textureCamera); _textureCamera = null; _texture = null; } _content = null; _root = null; if (NoesisGUISystem.IsInitialized) { Noesis_NotifyDestroyRenderer(_rendererId); } }
///////////////////////////////////////////////////////////////////////////////// public UIRenderer(Noesis.FrameworkElement content, UnityEngine.Vector2 offscreenSize, UnityEngine.GameObject target) { _rendererId = Noesis_CreateRenderer(Noesis.FrameworkElement.getCPtr(content).Handle); _content = content; _root = VisualTreeHelper.GetRoot(_content); _offscreenSize = offscreenSize; _mousePos = UnityEngine.Input.mousePosition; _target = target; _texture = FindTexture(); if (IsRenderToTexture) { _textureCamera = _target.AddComponent <Camera>(); _textureCamera.clearFlags = CameraClearFlags.SolidColor; _textureCamera.backgroundColor = new UnityEngine.Color(0.0f, 0.0f, 0.0f, 0.0f); _textureCamera.renderingPath = RenderingPath.Forward; _textureCamera.depthTextureMode = DepthTextureMode.None; #if !UNITY_4_6 && !UNITY_5_0 && !UNITY_5_1 _textureCamera.opaqueSortMode = UnityEngine.Rendering.OpaqueSortMode.NoDistanceSort; #endif _textureCamera.transparencySortMode = TransparencySortMode.Orthographic; _textureCamera.clearStencilAfterLightingPass = false; _textureCamera.allowHDR = false; _textureCamera.useOcclusionCulling = false; _textureCamera.cullingMask = 0; _textureCamera.targetTexture = _texture; } _targetCamera = _target.GetComponent <Camera>(); _Panels.Add(_rendererId, _target.GetComponent <NoesisGUIPanel>()); }