UI HUGE UPDATE
This commit is contained in:
@@ -182,18 +182,22 @@ namespace EasyChart.UGUI
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
// Don't cleanup during activation/deactivation - use OnDestroy instead
|
||||
_isInitialized = false;
|
||||
|
||||
_lastScreenRect = new Rect(float.NaN, float.NaN, float.NaN, float.NaN);
|
||||
|
||||
// Clear visual elements but don't destroy components
|
||||
if (_chartElement != null)
|
||||
|
||||
if (UsesRenderTexturePipeline())
|
||||
{
|
||||
_chartElement.RemoveFromHierarchy();
|
||||
_chartElement = null;
|
||||
if (_chartElement != null)
|
||||
{
|
||||
_chartElement.RemoveFromHierarchy();
|
||||
_chartElement = null;
|
||||
}
|
||||
|
||||
_rootContainer = null;
|
||||
return;
|
||||
}
|
||||
_rootContainer = null;
|
||||
|
||||
DetachOverlayChartContent();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
@@ -312,6 +316,10 @@ namespace EasyChart.UGUI
|
||||
return;
|
||||
}
|
||||
|
||||
// The bridge fully owns this UIDocument tree. Clear any previous
|
||||
// runtime content so overlay panels do not leave stale chart visuals behind.
|
||||
_uiDocument.rootVisualElement.Clear();
|
||||
|
||||
// Create root container that will be positioned to match RectTransform
|
||||
_rootContainer = new VisualElement();
|
||||
_rootContainer.name = "ChartBridgeRoot";
|
||||
@@ -332,7 +340,7 @@ namespace EasyChart.UGUI
|
||||
_lastScreenRect = new Rect(float.NaN, float.NaN, float.NaN, float.NaN);
|
||||
}
|
||||
|
||||
private void CleanupUIDocument()
|
||||
private void DetachOverlayChartContent()
|
||||
{
|
||||
if (_chartElement != null)
|
||||
{
|
||||
@@ -340,7 +348,21 @@ namespace EasyChart.UGUI
|
||||
_chartElement = null;
|
||||
}
|
||||
|
||||
_rootContainer = null;
|
||||
if (_rootContainer != null)
|
||||
{
|
||||
_rootContainer.RemoveFromHierarchy();
|
||||
_rootContainer = null;
|
||||
}
|
||||
|
||||
if (_uiDocument != null && _uiDocument.rootVisualElement != null)
|
||||
{
|
||||
_uiDocument.rootVisualElement.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void CleanupUIDocument()
|
||||
{
|
||||
DetachOverlayChartContent();
|
||||
|
||||
// Use delayed destruction to avoid issues during activation/deactivation
|
||||
if (_uiDocument != null)
|
||||
@@ -639,8 +661,14 @@ namespace EasyChart.UGUI
|
||||
{
|
||||
_rawImage = gameObject.AddComponent<UnityEngine.UI.RawImage>();
|
||||
}
|
||||
else
|
||||
{
|
||||
_rawImage.enabled = true;
|
||||
}
|
||||
|
||||
_rawImage.texture = _renderTexture;
|
||||
_rawImage.raycastTarget = false;
|
||||
_rawImage.color = Color.white;
|
||||
|
||||
_lastScreenRect = new Rect(float.NaN, float.NaN, float.NaN, float.NaN);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user