Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    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.     }