diff --git a/Sources/SwiftGodot/Core/GenericSignal.swift b/Sources/SwiftGodot/Core/GenericSignal.swift index 8a8dbf755..f8492f4f6 100644 --- a/Sources/SwiftGodot/Core/GenericSignal.swift +++ b/Sources/SwiftGodot/Core/GenericSignal.swift @@ -97,8 +97,8 @@ extension Arguments { // try to unpack the variant as the expected type let value: T? - if (argument.gtype == .object) && (T.Representable.godotType == .object) { - value = argument.asObject(T.self as! Object.Type) as? T + if let objectType = type as? Object.Type, (argument.gtype == .object) && (T.Representable.godotType == .object) { + value = argument.asObject(objectType) as? T } else { value = T(argument) }