mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
修复动态添加组件时Inspector可能异常的问题
This commit is contained in:
@@ -66,6 +66,8 @@ slug: /changelog
|
||||
|
||||
## master
|
||||
|
||||
* (2023.04.11) 修复动态添加组件时`Inspector`可能异常的问题
|
||||
|
||||
## v3.6.0
|
||||
|
||||
版本要点:
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -102,7 +103,8 @@ namespace XCharts.Editor
|
||||
editor.OnDisable();
|
||||
|
||||
m_Editors.Clear();
|
||||
for (int i = 0; i < chart.components.Count; i++)
|
||||
var count = Mathf.Min(chart.components.Count, m_ComponentsProperty.Count);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (chart.components[i] != null)
|
||||
{
|
||||
@@ -119,7 +121,7 @@ namespace XCharts.Editor
|
||||
|
||||
if (!m_EditorTypes.TryGetValue(settingsType, out editorType))
|
||||
editorType = typeof(MainComponentBaseEditor);
|
||||
var editor = (MainComponentBaseEditor) Activator.CreateInstance(editorType);
|
||||
var editor = (MainComponentBaseEditor)Activator.CreateInstance(editorType);
|
||||
editor.Init(chart, component, property, m_BaseEditor);
|
||||
|
||||
if (index < 0)
|
||||
|
||||
Reference in New Issue
Block a user