Skip to content

Commit

Permalink
Fix SerializedObjectHelperUtils stack overflow bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dqIndieGames committed Nov 5, 2023
1 parent 718bd12 commit 8e523a0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ public abstract class SpriteEditorSelectModuleBase : SpriteEditorModuleBase


protected List<SpriteRect> selectionSpriteRectList = new();


private bool isSingleSpriteDragAndDrop = false;


protected bool isSingleSpriteDragAndDrop { get; private set; }




Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ public static void GetAllDependAssets<T>(Object obj, List<T> resultList)

findedHashSet.Clear();

GetAllDependAssetsStart(obj, resultList);

}



private static void GetAllDependAssetsStart<T>(Object obj, List<T> resultList)
where T : Object
{


switch (obj)
{
case GameObject gameObject:
Expand Down Expand Up @@ -55,7 +66,7 @@ private static void GetAllDependAssetsInternal<T>(GameObject gameObject, List<T>
}


GetAllDependAssets(component, resultList);
GetAllDependAssetsStart(component, resultList);

}

Expand All @@ -66,6 +77,12 @@ private static void GetAllDependAssetsInternal<T>(Object obj, List<T> resultList
where T : Object
{

// check finded
if (!findedHashSet.Add(obj))
{
return;
}

var serializedObject = new SerializedObject(obj);


Expand Down Expand Up @@ -93,7 +110,7 @@ private static void GetAllDependAssetsInternal<T>(Object obj, List<T> resultList
}
else
{
GetAllDependAssets(property.objectReferenceValue, resultList);
GetAllDependAssetsStart(property.objectReferenceValue, resultList);
}
}
}
Expand Down

0 comments on commit 8e523a0

Please sign in to comment.