Eggys Games

News Archive

Unity - C# Class for doing a FadeOut Remove

To save performance you're going to have to remove objects. However having things simply dissapear sometimes is not a good look for the players. A good solution to this is a fadeout. You see it very commonly for mass produced decals such as bulletholes. 

To remove an object instantly you can simply use 

Destroy (gameObject);

But if we want to get a bit more fancy and do the fade out, here is a class you can simply drag and drop onto any sprite you are using in unity to make it fadeout. In the inspector you can set the time until it will dissapear. 

As you can see, first we have to get a reference to the sprite component. We then use Unitys colour class to make a reference to it's alpha property.

Once the countdown you have set in the inspector reaches 0 it will fade out. You can change the speed of its fade next to colourfade however I felt .03 was a good speed, this means it will dissapear in about a second. 

public class DestroyFadeOut : MonoBehaviour {

    public float deathremovetimer;

    private Color mycolour; 
    private float colourfade = 1;

    void Start () {
        mycolour = GetComponent<spriterenderer> ().color;
        mycolour.a = 1f;
    void Update () {

            deathremovetimer -= Time.deltaTime;

            if (deathremovetimer <= 0) {
                colourfade -= 0.03f;
                mycolour.a = colourfade;
                GetComponent<spriterenderer> ().color = mycolour;
                if (colourfade <= 0) {
                    Destroy (gameObject);


Here we can see how the fadeOut will look

Hope you find this class useful.

Leave a comment Posted in Game Making Programming by Eggy on

Ready Player One

I recently watched Ready Player One and I loved it. As a game developer it explored lots of different games, their characters and even the journey the game developer went through in making the virtual reality world. It was a mix between gaming and The Matrix. 

Seeing the The Iron Giant in it filled me with nostaglia too. I used to watch it a lot as a kid. I won it in a colour in competition by colouring in every part of the giant a different colour. 

If you like games and sci-fi I highly recommend this movie. It has a bit of everything in it that you will love. The storyline is good, it mixes real life and gaming life perfectly and remains accurate to gamers.


Leave a comment Posted in Movies and Shows by Eggy on

Graphic Sheets for Later Use

When you get art it's good to arrange them it easy to use graphic sheets like you can see below. It helps to be able to open them at any time and drag and drop them into your game. Stuff like this is very versatile to be re-used for future games. As long as you don't overdo it and re-use all of them per game, you can get away with slipping in some old graphics you drew.

Graphic sheet from The Tower and The Unfair Platformer and Smithys Quest

Leave a comment Posted in Game Making Art by Eggy on