C# Script Problem

Hi everyone !
I work on a script and I don’t understand why my button work like that
This is my code :

Public Button M4A1;

Button btnM4A1.GetComponent();
btnM4A1.onClick.AddListener(delegate {
Debug.Log(“M4A1”);
indexSlider = 0;
BtnOnClick(indexSlider);
});

So when I press the button for the first time the log write : M4A1 but when I press the butten twice the Debug.Log says : M4A1 three times and when I hit the button 3 times the Debug.Log writes me M4A1 FIVE Times
And I don’t know how to resolve this fuc***** problem
Any ideas ?
thx

  1. Use code tags, please.
  2. Where are you putting this AddListener code? It sounds like you’re continuously calling this code, so you’re adding the same lambda several times.

The Addlistener code is in void Start()

Okay thx BlackPete I have founded the problem I all for me ! THX A LOT