how to script an event to only happen once throughout the game?

im making an immersive game, and i want to know how to make something happen only once.
like say, if i look at an object, it triggers an audio clip of the character saying something, but i do not want that clip to play EVERY time the player looks at that object.

how would i go about doing this?

and how would i save the fact that it has already happened in the current playthrough so that it doesnt reset when the player exits and re-enters the game?

Set a variable in your script…

i.e

bool event1Happened = false;

Then once it is set, set it to true.
Then if the player looks at the object again, check the value of event1Happened.

To save the value of event1Happened, look at PlayerPrefs to store the value of event1Happened.

When your script loads again for the first time, check PlayerPrefs again.