Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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.     }