Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Action performed twice when clicked.

Discussion in 'Input System' started by naviHenrique, May 30, 2021.

  1. naviHenrique

    naviHenrique

    Joined:
    May 9, 2021
    Posts:
    3
    I have this code but the action is always performed twice. I don't know why or how to correct it to be performed just once.

    Code (CSharp):
    1.     void Start()
    2.     {
    3.         playerActionControls.Combat.LightAttack.performed += _ => DoLightAttack();
    4.     }
    5.  
    6.     private void DoLightAttack()
    7.     {
    8.         Debug.Log("LightAttack + TakeDamage(20.0f)");
    9.         TakeDamage(20.0f);
    10.     }