void Start() { if (!m_EditorWindowCapture) { m_EditorWindowCapture = GetComponent <EditorWindowCapture>(); } if (!m_RawImage) { m_RawImage = GetComponent <RawImage>(); } if (m_RawImage) { // Texture comes in flipped, so it's necessary to correct it var rect = m_RawImage.uvRect; rect.height *= -1f; m_RawImage.uvRect = rect; } if (!m_RawImage && !m_Material) { var renderer = GetComponent <Renderer>(); m_Material = U.Material.GetMaterialClone(renderer); } if (m_Material) { // Texture comes in flipped, so it's necessary to correct it var scale = m_Material.mainTextureScale; scale.y *= -1f; m_Material.mainTextureScale = scale; } }
public override void Setup() { // Initial bounds must be set before the base.Setup() is called minBounds = new Vector3(0.727f, MinBounds.y, 0.4f); m_CustomStartingBounds = minBounds; base.Setup(); preventResize = true; m_CaptureWindow = this.InstantiateUI(m_CaptureWindowPrefab).transform; m_CaptureWindow.SetParent(m_WorkspaceUI.topFaceContainer, false); m_CaptureWindow.localPosition = new Vector3(0f, -0.007f, -0.5f); m_CaptureWindow.localRotation = Quaternion.Euler(90f, 0f, 0f); m_CaptureWindow.localScale = new Vector3(1f, 1f, 1f); var bounds = contentBounds; var size = bounds.size; size.z = 0.1f; bounds.size = size; contentBounds = bounds; var handle = m_CaptureWindow.GetComponent <BaseHandle>(); handle.hovering += OnHovering; handle.dragStarted += OnDragStarted; handle.dragging += OnDragging; handle.dragEnded += OnDragEnded; m_Capture = m_CaptureWindow.GetComponent <EditorWindowCapture>(); }