I just started with Unity a few weeks ago. This probably has a very simple solution, but I cannot find an answer I could understand on the web. I want to fade out an object. The answers I found so far mentions about shaders and alpha channels, but I don't understand what it means. Help is appreciated!
Simple code. Use the first line as a variable and then the second in some sort of controlled environment such as an if statement inside a the Update loop. Code (csharp): SpriteRenderer sprRenderer = GetComponent<SpriteRenderer>(); spriteRenderer.color = Color.Lerp(spriteRenderer.color, Color.clear, 3f * Time.deltaTime); Just a simple base. Don't use this code exactly as it won't get what you are looking for. Modify it a bit to make it fade in both ways. Maybe optimize somehow by only allowing the color to shift under certain conditions. Obviously only use GetComponent once in your Awake function.