About removing the backlight of a button after a set of time

Hello,
I’m working on an on screen keyboard. Currently my problem is that I want to remove the backlight of a button that’s been selected after 1 or 2 second(s). I’ve tried the “Destroy” function and “Yield”, but neither works well. I know it’s my own problem but can somebody give me some hints? Really no ideas now…
Thanks very very very very much~!

Should the highlight on button 1 immediately snap off if someone quickly presses button 2? In other words, will there only ever be one highlight? Or will quickly pressing buttons 1,2,3,4 give me a delayed effect “wink out 1”, “wink out 2” … ? Are the buttons all the same size?

If only 1 highlight ever and all same size, can make a single traveling highlight. A cheap way to wink out is to store “lastMovedtime,” reset it to current time at each move, and check in Update if the lastMovedTime was over 2 seconds ago. Instead of destroying it, can set it inactive, or disable the renderer (or teleport it to -999.)

If you need a highlight for each button, you could also use that trick (every single button would have its own lastClickedTime and a script checking it.) Or, if you go the yield route, look up Coroutines. Yields can only be used in them. They let you say fire&forget things like “turn this off in 2 seconds.” But, you’ll have to worry about someone clicking a button again after 1.8 seconds (method#1 will just bump up lastClickedTime, so will work.)

Can’t you just use Invoke? Setup a function to have invoked after a few seconds that will turn off the lit key.