WIndows Platform,How to Prevent Window from Turning Black When Windows is in Sleep or Lock Screen Mode in Unity-built Windows Application?

Hello everyone,

I have a Unity-built Windows application (A.exe) that is scheduled to restart daily at 3 AM via a scheduled task. However, when the computer enters sleep or lock screen mode, the window of A.exe turns black, even though other interactions with the application still work fine.

Has anyone encountered this issue before? Is there a way to prevent the window from going black when the system is in sleep or lock screen mode, while ensuring that other interactions (such as background processes) continue to function properly?

Any suggestions or solutions would be greatly appreciated!

Thanks in advance!

Can someone please answer my question? I would be immensely grateful!

I haven’t had this issue before. I’d recommend creating a small project that can repo the issue. Then try upgrading Unity to see if it was fixed in a future update (Unity 2021 is a bit old). If it still doesn’t work then you might need to make a bug report. It sounds like a engine bug so I think only Unity will be able to fix it.

Thank you for your answer!