mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 10:20:10 +00:00
确保XChartsMgr只有一个
This commit is contained in:
@@ -55,7 +55,8 @@ namespace XCharts
|
|||||||
m_XCharts = FindObjectOfType<XChartsMgr>();
|
m_XCharts = FindObjectOfType<XChartsMgr>();
|
||||||
if (m_XCharts == null)
|
if (m_XCharts == null)
|
||||||
{
|
{
|
||||||
GameObject obj = new GameObject("_xcharts_");
|
var obj = GameObject.Find("_xcharts_");
|
||||||
|
if (obj == null) obj = new GameObject("_xcharts_");
|
||||||
m_XCharts = obj.AddComponent<XChartsMgr>();
|
m_XCharts = obj.AddComponent<XChartsMgr>();
|
||||||
}
|
}
|
||||||
m_XCharts.m_NowVersion = fullVersion;
|
m_XCharts.m_NowVersion = fullVersion;
|
||||||
@@ -66,6 +67,11 @@ namespace XCharts
|
|||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
if (m_XCharts != null)
|
||||||
|
{
|
||||||
|
GameObject.DestroyImmediate(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
SerieLabelPool.ClearAll();
|
SerieLabelPool.ClearAll();
|
||||||
m_ChartList.Clear();
|
m_ChartList.Clear();
|
||||||
XThemeMgr.ReloadThemeList();
|
XThemeMgr.ReloadThemeList();
|
||||||
|
|||||||
Reference in New Issue
Block a user