In this video we see how to change the alpha component at runtime in Unity, this could be useful to make objects fade out at runtime.
First of all our material has to allow transparency, by default, Unity's Standard Shader in the "Opaque" mode doesn't do it, you need to change the rendering mode to "Fade" or "Transparent", that way the alpha component makes the object vanish in some way.
To change transparency at runtime in the script you need to define a reference for the material you want to modify, then initialize that reference somehow, in this case we drag the Material from the project folder to the variable in the inspector. Once you do that you can directly change the color of the material at runtime.
____________________________________________________________
PORTFOLIO: https://gamedevtraum.com/en/portfolio...
CONTACT: / gamedevtraum
LINKEDIN: / gamedevtraum
DONATIONS
-You can download one of me free assets for Unity from my ITCH page and leave a donation
-You can donate with the THANKS button on every video
____________________________________________________________