protected virtual void DoUpdate() { updateSampler.Begin(); var targetSize = targetTexture == null ? GetActiveRenderTargetSize() : new Vector2(targetTexture.width, targetTexture.height); if (targetTexture != m_TargetTexture) { m_TargetTexture = targetTexture; InternalBridge.SetTargetTexture(panel, targetTexture); } // Temporary: clamp scale to prevent font atlas running out of space // won't be needed when using TextCore var scale = Mathf.Max(0.1f, m_PanelScaler == null ? 1 : m_PanelScaler.ComputeScalingFactor(targetSize)); if (m_Scale != scale || m_TargetSize != targetSize) { InternalBridge.SetScale(panel, scale == 0 ? 0 : 1.0f / scale); visualTree.style.left = 0; visualTree.style.top = 0; visualTree.style.width = targetSize.x * scale; visualTree.style.height = targetSize.y * scale; m_Scale = scale; m_TargetSize = targetSize; } InternalBridge.UpdatePanel(panel); updateSampler.End(); }
/// <summary> /// Implementation of Update() /// </summary> public void Update() { if (panel == null) { return; } #if UNITY_EDITOR if (enableLiveUpdates && m_TrackedAssetList != null && m_TrackedAssetHashes != null) { for (int i = 0; i < m_TrackedAssetList.Count; ++i) { var asset = m_TrackedAssetList[i]; var hash = EditorUtility.GetDirtyCount(asset); var cachedHash = m_TrackedAssetHashes[i]; if (hash == cachedHash) { continue; } // RecreateUIFromUxml(); return; } } #endif m_UpdateSampler.Begin(); var targetSize = targetTexture == null ? GetActiveRenderTargetSize() : new Vector2(targetTexture.width, targetTexture.height); if (targetTexture != m_TargetTexture) { m_TargetTexture = targetTexture; InternalBridge.SetTargetTexture(panel, targetTexture); } // Temporary: clamp scale to prevent font atlas running out of space // won't be needed when using TextCore var scale = Mathf.Max(0.1f, m_PanelScaler == null ? 1 : m_PanelScaler.ComputeScalingFactor(targetSize)); if (m_Scale != scale || m_TargetSize != targetSize) { InternalBridge.SetScale(panel, scale == 0 ? 0 : 1.0f / scale); visualTree.style.left = 0; visualTree.style.top = 0; visualTree.style.width = targetSize.x * scale; visualTree.style.height = targetSize.y * scale; m_Scale = scale; m_TargetSize = targetSize; } InternalBridge.UpdatePanel(panel); m_UpdateSampler.End(); }