Since I constantly keep forgetting to comment logs out in my releases, I tried to leverage Codeware's Reflection as follow:
module MyMod
public static func E(str: String) -> Void {
let fun = Reflection.GetGlobalFunction(n"LogChannel");
if IsDefined(fun) {
fun.Call([ToVariant(n"DEBUG"), ToVariant(s"[MyMod] \(str)")]);
}
}
Which lead to a crash on game startup, right after the "Cyberpunk 2077" animated logo.
What is more disturbing is that there's no Cyberpunk stacktrace Report / no log found in Codeware / successful compilation in Redscript with no apparent error / no error in RED4ext.
As I've stumbled upon weird bugs with e.g. booleans / temporary array in Redscript in the past, I also tried cleaning up my script as follow, which didn't change the outcome:
module MyMod
public static func E(str: String) -> Void {
let fun = Reflection.GetGlobalFunction(n"LogChannel");
let exists = IsDefined(fun);
if exists {
let args: array<Variant> = [ToVariant(n"DEBUG"), ToVariant(s"[MyMod] \(str)")];
let _ = fun.Call(args);
}
}
The call should be fun.Call([n"DEBUG", AsRef(s"[MyMod] \(str)")]);.
Argument compatibility check has been improved in 1.8.3. It should prevent crashes.
Hello!
Since I constantly keep forgetting to comment logs out in my releases, I tried to leverage
Codeware
'sReflection
as follow:Which lead to a crash on game startup, right after the "Cyberpunk 2077" animated logo.
What is more disturbing is that there's no Cyberpunk stacktrace Report / no log found in
Codeware
/ successful compilation inRedscript
with no apparent error / no error inRED4ext
.As I've stumbled upon weird bugs with e.g. booleans / temporary array in
Redscript
in the past, I also tried cleaning up my script as follow, which didn't change the outcome:Thanks for your time, as always.