Skip to content

Instantly share code, notes, and snippets.

@syl3n7
Created January 15, 2023 15:08
Show Gist options
  • Save syl3n7/23eb7a394e1140549e4b0aac01e5b842 to your computer and use it in GitHub Desktop.
Save syl3n7/23eb7a394e1140549e4b0aac01e5b842 to your computer and use it in GitHub Desktop.
Get Battery status and change sprite acordingly
void CheckBattery()
{
//if (menuPanel.activeSelf)
//{
//playername.text = PlayerPrefs.GetString("Name");
if (battery == BatteryStatus.Charging) batteryimg.sprite = Resources.Load<Sprite>("bateriaCharging");
else if (battery == BatteryStatus.Discharging) batteryimg.sprite = Resources.Load<Sprite>("bateriaDischarging");
else batteryimg.sprite = Resources.Load<Sprite>("bateriaFull");
//}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment