private void SetRemoveCallback(ReorderableList list, List <FSMTransitionCondition> targetList) { list.onRemoveCallback = (ReorderableList rlist) => { int j = rlist.index; FSMTransitionCondition dataCondition = targetList[j]; targetList.RemoveAt(j); if (dataCondition) { dataCondition.hideFlags = HideFlags.None; DestroyImmediate(dataCondition); EditorGUIUtility.ExitGUI(); } }; }
private void AddItem(object obj) { AssetInfo <ReorderableList> assetInfo = obj as AssetInfo <ReorderableList>; if (assetInfo == null) { return; } Type assetType = GetObjectType(assetInfo.AssetPath); FSMTransitionCondition newCondition = Target.gameObject.AddComponent(assetType) as FSMTransitionCondition; int index = assetInfo.ComplementaryData.serializedProperty.arraySize++; assetInfo.ComplementaryData.serializedProperty.GetArrayElementAtIndex(index).objectReferenceValue = newCondition; newCondition.hideFlags = HideFlags.HideInInspector; serializedObject.ApplyModifiedProperties(); }