How to get the event of a BatteryStatus change?

I would like to capture the event of SystemInfo.BatteryStatus change in Unity.

How could I do that?


hello ;
for that u need to create a plugin ;
i think u can search in asset store and find some plugins for it ;

like :
Native Plugin

how come the simple:
if ((SystemInfo.batteryStatus == BatteryStatus.Charging) (or something similar)

does not work? I can’t seem to find any information about it. The debug always says that charging = true. You can make things happen for charge, but discharging doesn’t seem to trigger after build. I’m lost

This can be done easily like this. :slight_smile: