diff --git a/Assets/SimpleSpriteSelect/Demo/SpriteDragTest/SpriteListBehaviour.prefab b/Assets/SimpleSpriteSelect/Demo/SpriteDragTest/SpriteListBehaviour.prefab index 90369bb..99c82ef 100644 --- a/Assets/SimpleSpriteSelect/Demo/SpriteDragTest/SpriteListBehaviour.prefab +++ b/Assets/SimpleSpriteSelect/Demo/SpriteDragTest/SpriteListBehaviour.prefab @@ -44,4 +44,15 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9550a5ec5f2fd3e44bf3f388657ceac2, type: 3} m_Name: m_EditorClassIdentifier: - spriteList: [] + spriteList: + - {fileID: -1818584816, guid: fdebc19e2d432a64ab02fa13fe431100, type: 3} + - {fileID: -2061715535, guid: fdebc19e2d432a64ab02fa13fe431100, type: 3} + - {fileID: -1004022116, guid: fdebc19e2d432a64ab02fa13fe431100, type: 3} + - {fileID: 109263268, guid: fdebc19e2d432a64ab02fa13fe431100, type: 3} + - {fileID: 829465713, guid: fdebc19e2d432a64ab02fa13fe431100, type: 3} + - {fileID: -212670014, guid: fdebc19e2d432a64ab02fa13fe431100, type: 3} + - {fileID: -776789061, guid: fdebc19e2d432a64ab02fa13fe431100, type: 3} + - {fileID: 979163657, guid: fdebc19e2d432a64ab02fa13fe431100, type: 3} + - {fileID: -444935751, guid: fdebc19e2d432a64ab02fa13fe431100, type: 3} + - {fileID: 1822210353, guid: fdebc19e2d432a64ab02fa13fe431100, type: 3} + - {fileID: 85206195, guid: fdebc19e2d432a64ab02fa13fe431100, type: 3} diff --git a/Assets/SimpleSpriteSelect/Editor/Normal/SpriteEditorSelectModuleNormal.cs b/Assets/SimpleSpriteSelect/Editor/Normal/SpriteEditorSelectModuleNormal.cs index f7cbd8e..aa1fe57 100644 --- a/Assets/SimpleSpriteSelect/Editor/Normal/SpriteEditorSelectModuleNormal.cs +++ b/Assets/SimpleSpriteSelect/Editor/Normal/SpriteEditorSelectModuleNormal.cs @@ -35,6 +35,11 @@ private void DragAndDropAllSelectionSpriteList() { return; } + + if (isSingleSpriteDragAndDrop) + { + return; + } // check left mouse down if (!Event.current.isMouse || Event.current.button != 0 || Event.current.type != EventType.MouseDown) diff --git a/Assets/SimpleSpriteSelect/Editor/SpriteEditorSelectModuleBase.cs b/Assets/SimpleSpriteSelect/Editor/SpriteEditorSelectModuleBase.cs index 0d1bb50..c81c1c9 100644 --- a/Assets/SimpleSpriteSelect/Editor/SpriteEditorSelectModuleBase.cs +++ b/Assets/SimpleSpriteSelect/Editor/SpriteEditorSelectModuleBase.cs @@ -28,9 +28,10 @@ public abstract class SpriteEditorSelectModuleBase : SpriteEditorModuleBase protected List selectionSpriteRectList = new(); - - - private bool isSingleSpriteDragAndDrop = false; + + + protected bool isSingleSpriteDragAndDrop { get; private set; } + diff --git a/Assets/SimpleSpriteSelect/Editor/Utils/SerializedObjectExtra/SerializedObjectHelperUtils.cs b/Assets/SimpleSpriteSelect/Editor/Utils/SerializedObjectExtra/SerializedObjectHelperUtils.cs index 962afec..687f8df 100644 --- a/Assets/SimpleSpriteSelect/Editor/Utils/SerializedObjectExtra/SerializedObjectHelperUtils.cs +++ b/Assets/SimpleSpriteSelect/Editor/Utils/SerializedObjectExtra/SerializedObjectHelperUtils.cs @@ -15,6 +15,17 @@ public static void GetAllDependAssets(Object obj, List resultList) findedHashSet.Clear(); + GetAllDependAssetsStart(obj, resultList); + + } + + + + private static void GetAllDependAssetsStart(Object obj, List resultList) + where T : Object + { + + switch (obj) { case GameObject gameObject: @@ -55,7 +66,7 @@ private static void GetAllDependAssetsInternal(GameObject gameObject, List } - GetAllDependAssets(component, resultList); + GetAllDependAssetsStart(component, resultList); } @@ -66,6 +77,12 @@ private static void GetAllDependAssetsInternal(Object obj, List resultList where T : Object { + // check finded + if (!findedHashSet.Add(obj)) + { + return; + } + var serializedObject = new SerializedObject(obj); @@ -93,7 +110,7 @@ private static void GetAllDependAssetsInternal(Object obj, List resultList } else { - GetAllDependAssets(property.objectReferenceValue, resultList); + GetAllDependAssetsStart(property.objectReferenceValue, resultList); } } }