click to change over mod

I need press “Mouse 3”(Fire3) to change light intensitivity.
What am I doing wrong ?
How to make on enable constantly taking battery ? Only taking on Enable flashlight. :frowning:

enter code hereusing using UnityEngine;

using System.Collections;
using System;
using System.Text;

public class FlashLight : MonoBehaviour
{
    private bool FlashLights = false;

    public static float BatteryLife = 100f;
    public float TakeLifeInterval1 = 0.2f;
    public float TakeLifeInterval2 = 0.5f;
    public float TakeLifeInterval3 = 0.9f;

    void OnGUI()
    {
        GUI.Box(new Rect(40, 50, 90, 25), " Battery: " + BatteryLife); // Umístnění z leva do prava, Umstínění Z hora dolu, Šířka, Výška
    }

    void Start()
    {
        BatteryLife = 100f;
        TakeLifeInterval1 = 0.2f;
        TakeLifeInterval2 = 0.5f;
        TakeLifeInterval3 = 2f;
    }

    void Update()
    {
        if (Input.GetMouseButton(0) && FlashLights == false)
        {
            Debug.Log("Baterka Zapnuta");
            FlashLights = true;
            BatteryLife = BatteryLife - TakeLifeInterval1;
            light.intensity = 1;
            audio.Play();
        }
        else if (Input.GetMouseButton(2) && FlashLights == false)
        {
            Debug.Log("Baterka Zapnuta 1");
            FlashLights = true;
            BatteryLife = BatteryLife - TakeLifeInterval1;
            light.intensity = 1;
            audio.Play();
        }
        else if (Input.GetMouseButton(2) && FlashLights == false)
        {
            Debug.Log("Baterka Zapnuta 2");
            FlashLights = true;
            BatteryLife = BatteryLife - TakeLifeInterval2;
            light.intensity = 3;
            audio.Play();
        }
        else if (Input.GetMouseButton(2) && FlashLights == false)
        {
            Debug.Log("Baterka Zapnuta 3");
            FlashLights = true;
            BatteryLife = BatteryLife - TakeLifeInterval3;
            light.intensity = 6;
            audio.Play();
        }
        else if (Input.GetMouseButton(1) && FlashLights == true)
        {
            Debug.Log("Baterka Vypnuta");
            FlashLights = false;
            light.intensity = 0;
            audio.Play();
        }
    }
}

You have several if (Input.GetMouseButton(2) && FlashLights == false) statements that are identical to eachother.

Either the first one, or none of them will ever go through. Other than that, your question sounds like it’s two part.