Encapsulating Alpha Fade in Unity3d

Several days into my late Unity3d project I realised that the was a bulk of code designed solely to make an object invisible by fading it out of the scene. The code was not complex although because of the way it was all in one class it appeared complex. After doing some research into the best way to go about making this change, realised it was both convenient and logical to extract the code into a separate script and attaching that to the object that I wished to apply the effect to. This meant that instead of nested if-statements for state management in a script attached to the Main Camera I was able to make declarative statements: ...

November 12, 2010 · 2 min