Hello,
I study modelling and texturing, not scripting. I have NEVER understood scripting and wasted a lot of time making sure the } or ] is in the right place, so currently I am copy pasting so I can focus on other things.
Recently I redid the 'Clock' tutorial using a clock model I made myself.
and I have been learning to make lights flicker.
https://youtu.be/CZKaB2UyRZkhowever this affects point lights.
I would like to make a script which makes emissive shaders flicker.
either by cannibaling the script in the youtube video above or another way.
thank you.
Replies
Simple question: do you absolutely have to do it via script?
If, indeed, you are just "copy-pasting so you can focus on other things", why not try creating a simple animation for the flicker? Lots of random values with linear interpolation between each.
Anyway, if you're trying to learn how to actually do it by script, then a quick search would land you on this page: https://docs.unity3d.com/ScriptReference/Material.SetFloat.html
Start by accessing the material parameters in your script, practice with changing different values and colors, and then, once you have a firm grasp of the logic of it all, you can try to re-implement the content of the "Update" method from the video you picked.
I'd be weary of using that video as a starting point though, as it contains lots of code that just calculates a value (which can be visually overwhelming for a beginner, I suppose), instead of getting you accustomed to playing around with components.
Good luck
Are you still looking for a solution? If So I might be able to help. I am not a programmer either but I am studying it as a hobby as I am more of a 3D artist. I made a script for my game that gets the emissive to flicker. It may not be the best and well optimized script but it works for what I wanted it for. I am not at home but I can check if you still need it.