Skip to content

Commit f6a999f

Browse files
committed
Fixed an exception that occurs when a VFX Graph window is open and the open VFX Graph asset is searched for references (there may be other similar edge cases, as well)
1 parent 8441e47 commit f6a999f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -985,9 +985,13 @@ private ReferenceNode SearchObject( object obj )
985985
if( obj == null || obj.Equals( null ) )
986986
return null;
987987

988-
// Avoid recursion (which leads to stackoverflow exception) using a stack
989-
if( callStack.ContainsFast( obj ) )
990-
return null;
988+
// Avoid recursion (which leads to stackoverflow exception) using a stack (initially, I was using callStack.ContainsFast
989+
// here but it returned false for objects that do exist in the call stack if VFX Graph window was open)
990+
for( int i = callStack.Count - 1; i >= 0; i-- )
991+
{
992+
if( callStack[i].Equals( obj ) )
993+
return null;
994+
}
991995

992996
bool searchingSourceAsset = searchingSourceAssets && ReferenceEquals( currentSearchedObject, obj );
993997

0 commit comments

Comments
 (0)