How to add 1 to a score when a Boolean value becomes true?

I have a Bool “touched”. I also have a Float “score”.

In the Update() function I have done:


score = score + 1;


However, because this is in the update function, the score continues to rise by a value of 1 for as long as the boolean is true.

How can I increment the score JUST by 1 when the boolean becomes true?

Many thanks,

You have to change bool value somewhere, just add score then .
or add third variable.

if(touched & !added){