I want to create a flashlight, when you press 1 beam appears, but I want it to disappear after a second. I made it, but my code doesn't work. My code:
from ursina import *
app = Ursina()
def flashlight(): # flashlight code
f = Entity(model='sphere', scale=4, color=color.light_gray)
time.sleep(1.0) #pause
f.visible = False #disappearing
def update():
if held_keys['1']: flashlight()
app.run()```