How to get the event of a BatteryStatus change?
Hi! I would like to capture the event of SystemInfo.BatteryStatus change in Unity.
How could I do that?
Thanks!
Answer by Cuttlas-U · Oct 02, 2017 at 03:44 PM
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
Answer by SnailGirl · Mar 23, 2018 at 06:41 PM
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
Answer by exzizt · Mar 24, 2018 at 04:39 AM
This can be done easily like this. :)
https://answers.unity.com/questions/1206632/trigger-event-on-variable-change.html