diff --git a/unity/Assets/core/upm/Editor/Src/Generator/DTS.cs b/unity/Assets/core/upm/Editor/Src/Generator/DTS.cs index fbd9759f45..77a275061b 100644 --- a/unity/Assets/core/upm/Editor/Src/Generator/DTS.cs +++ b/unity/Assets/core/upm/Editor/Src/Generator/DTS.cs @@ -681,8 +681,10 @@ static void AddRefType(HashSet workTypes, HashSet refTypes, Type typ } } - if (refTypes.Contains(rawType) || type.IsPointer || rawType.IsPointer) return; - if (!rawType.IsGenericParameter) + // if type == rawType, there is a chance that the type is already added to refTypes when it was a rawType. + // so, when refTypes contains rawType but type == rawType, most of the remain logic is still needed to run. + if ((refTypes.Contains(rawType) && type != rawType) || type.IsPointer || rawType.IsPointer) return; + if (!rawType.IsGenericParameter && !refTypes.Contains(rawType)) { refTypes.Add(rawType); }