How to play a sound just once.

hi. I have a game and 2 objects in game.I want to play sound when two objects touch each other.
here is my code:

public AudioSource ses;
    public Collider2D küp;
    Collider2D obje;
	void Start () {
        obje = gameObject.GetComponent<Collider2D>();
        ses = gameObject.GetComponent<AudioSource>();
	}
	
	
	void Update () {
        if (obje.IsTouching(küp))
        {
            ses.Play();
            

        }
	}

But with this code i cant get what i want.This code plays sound while objects touching each other.But ı want to play just one time when they first time touch each other

You need to play sound in OnCollisionEnter2D() function. More info here.

public AudioSource ses;
public Collider2D küp;
Collider2D obje;
void Start () {
obje = gameObject.GetComponent();
ses = gameObject.GetComponent();
}

    void OnCollisionEnter2D() {
     ses.Play();
    }

I guess this is how you do it.
Code untested.