修复拖出制作预设时异常的问题

This commit is contained in:
monitor1394
2019-10-31 09:40:12 +08:00
parent 16c8d26e2a
commit 2dc3c2f759
3 changed files with 12 additions and 2 deletions

View File

@@ -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;

View File

@@ -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++)
{

View File

@@ -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);