mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-30 13:28:47 +00:00
修复动态添加组件时Inspector可能异常的问题
This commit is contained in:
@@ -72,6 +72,7 @@ namespace XCharts.Runtime
|
|||||||
CreateComponentHandler(component);
|
CreateComponentHandler(component);
|
||||||
#if UNITY_EDITOR && UNITY_2019_1_OR_NEWER
|
#if UNITY_EDITOR && UNITY_2019_1_OR_NEWER
|
||||||
UnityEditor.EditorUtility.SetDirty(this);
|
UnityEditor.EditorUtility.SetDirty(this);
|
||||||
|
OnBeforeSerialize();
|
||||||
#endif
|
#endif
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
@@ -88,6 +89,7 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
component.index = list.Count;
|
component.index = list.Count;
|
||||||
list.Add(component);
|
list.Add(component);
|
||||||
|
m_Components.Sort((a, b) => { return a.GetType().Name.CompareTo(b.GetType().Name); });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckAddRequireChartComponent(Type type)
|
private void CheckAddRequireChartComponent(Type type)
|
||||||
@@ -179,6 +181,10 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
if (component.gameObject != null)
|
if (component.gameObject != null)
|
||||||
ChartHelper.SetActive(component.gameObject, false);
|
ChartHelper.SetActive(component.gameObject, false);
|
||||||
|
#if UNITY_EDITOR && UNITY_2019_1_OR_NEWER
|
||||||
|
UnityEditor.EditorUtility.SetDirty(this);
|
||||||
|
OnBeforeSerialize();
|
||||||
|
#endif
|
||||||
InitComponentHandlers();
|
InitComponentHandlers();
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user