How to optimize this

I made this kind of lighting with black cubes that get less opacity the closer they are to the light objects and made tons of them using fill grid extension, but at 300 rows it drops FPS a lot, even with “trigger once while true” it’s still around 20 FPS, how to make it not laggy?

What events have you got?
Is the light source moving?. If not then you don’t need to run the distance check all the time just when they’re created. If it is moving you could probably get away with checking every five frames and using ‘is on screen’ - what events have you got for this? Have you tried a tint expression related to a variable? shade=distance/4 and Tint set to ToString(255-object.shade)+“;”+ToString(255-object.shade)+“;”+ToString(255-object.shade)
you need to prevent shade going above 255

2 Likes

thanks, i’ll try that