auto objs = UObject::GetGlobalObjects();
for (int i = 0; i < objs.Num(); i++) {
auto Object = objs.GetByIndex(i);
if (isObjectInvalid(Object))
continue;
if (Config.HighRisk.NightMod) {
if (Object->IsA(USkyLightComponent ::StaticClass())) {
auto playerChar = (USkyLightComponent *) Object;
playerChar->SetLightColor(FLinearColor(0.0f,0.0f,0.0f,1.0f));
}}
else
if (Object->IsA(USkyLightComponent ::StaticClass())) {
auto playerChar = (USkyLightComponent *) Object;
playerChar->SetLightColor(FLinearColor(1.0f,1.0f,1.0f,1.0f));
}
}
Credit :-
@Bhatiaofficial