mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-17 14:00:12 +00:00
修复拖出制作预设时异常的问题
This commit is contained in:
@@ -96,7 +96,7 @@ namespace XCharts
|
||||
var btnPanel = transform.Find("chart_list");
|
||||
m_BtnClone = transform.Find("btn_clone").gameObject;
|
||||
m_BtnClone.SetActive(false);
|
||||
//ChartHelper.DestroyAllChildren(btnPanel);
|
||||
ChartHelper.DestroyAllChildren(btnPanel);
|
||||
foreach (var module in m_ChartModule)
|
||||
{
|
||||
var btnName = "btn_" + module.name;
|
||||
|
||||
@@ -289,7 +289,7 @@ namespace XCharts
|
||||
{
|
||||
var labelObject = ChartHelper.AddObject(s_SerieLabelObjectName, transform, chartAnchorMin,
|
||||
chartAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
|
||||
// ChartHelper.DestroyAllChildren(labelObject.transform);
|
||||
ChartHelper.DestroyAllChildren(labelObject.transform);
|
||||
int count = 0;
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,9 @@ using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
@@ -74,6 +77,13 @@ namespace XCharts
|
||||
|
||||
public static void DestroyAllChildren(Transform parent)
|
||||
{
|
||||
if(parent == null) return;
|
||||
#if UNITY_EDITOR
|
||||
if (PrefabUtility.IsPartOfAnyPrefab(parent.gameObject))
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
while (parent.childCount > 0)
|
||||
{
|
||||
var go = parent.GetChild(0);
|
||||
|
||||
Reference in New Issue
Block a user