So, i created a custom Unlit material that receives light information through Parameters, all is working well except, when i play the game, the Parameters seem to be updating too late, there’s a considerable lag when playing the game, as opposed to the Construction Script.
The thing is, the Construction Script is way more complex than the Update Function for the material, yet, it runs faster?
Here’s a video showing the problem:
As you can see, while moving the object in editor, the materials update instantly, but as soon as i hit Simulate, the materials lag horrendously to update, any idea what might be causing this lag?
I’m updating the material through standard Material Parameters, and a Dynamic Material Instance, the info i send to the material is just the position of the lamp, it’s direction, color and intensity.
There are no objects with tick enabled besides the one i’m updating, and the update occurs only when the object moves, it’s the exact same function with the Construction Script.