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

Removing the action.performed callback added with += _ =>

Discussion in 'Input System' started by Tymianek, Oct 17, 2021.

  1. Tymianek

    Tymianek

    Joined:
    May 16, 2015
    Posts:
    97
    Hello is there a way to remove a callback added like this:
    Code (CSharp):
    1. action.performed += _ => Debug.Log("Action performed")
    without doing a domain reload?
     
  2. Tymianek

    Tymianek

    Joined:
    May 16, 2015
    Posts:
    97
    anyone?
     
  3. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    You need to store your lambda in a variable declared before the lambda declaration, then you can use it to unregister the lambda.