File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ public override bool Equals(object o)
108108 ScriptableObjectCollectionItem other = o as ScriptableObjectCollectionItem ;
109109 if ( other == null )
110110 return false ;
111-
111+
112112 return guid . IsValid ( ) && other . guid . IsValid ( ) && guid == other . guid ;
113113 }
114114
@@ -117,10 +117,12 @@ public override bool Equals(object o)
117117 if ( ReferenceEquals ( left , right ) )
118118 return true ;
119119
120- if ( ReferenceEquals ( left , null ) )
121- return false ;
122-
123- if ( ReferenceEquals ( right , null ) )
120+ // Use Unity's implicit bool to detect destroyed objects
121+ bool leftNull = ReferenceEquals ( left , null ) || ! ( UnityEngine . Object ) left ;
122+ bool rightNull = ReferenceEquals ( right , null ) || ! ( UnityEngine . Object ) right ;
123+ if ( leftNull && rightNull )
124+ return true ;
125+ if ( leftNull || rightNull )
124126 return false ;
125127
126128 return left . Equals ( right ) ;
You can’t perform that action at this time.
0 commit comments