Fading away, looking through glass, or creating transparent effects like forcefields in Unity is a pretty straight forward process with more than one method. In this tutorial we’ll cover the most straight forward way, changing the properties of a material.

Start by opening or creating a new project. I’ll take an existing scene with a few point lights, a sphere, and a plane.

Next we’ll create a new material that will be our transparent material that will go on the sphere. You can do that by right clicking in the project pane then Create > Material just rename it to Transparent.

With our material created, click on it and then we’ll edit some values in the inspector. We’ll stick with the standard shader and then change the Rendering Mode to Transparent. This allows you to change the alpha channel on the color of the albedo in order to create the transparent effect.

Next we’ll do just that. Click the box to right of the albedo to bring up the color wheel which also governs the alpha channel. As an example set the Alpha channel to 50% and you should the preview reflect that.

Now apply the material to sphere, you can either apply it by changing the material in the Mesh Renderer or just simply dragging and dropping the material on the sphere in the scene. If it works the sphere should appear transparent.

There you have it, a transparent effect. You can tweak the material properties to produce a shinier or matte surface which in turn would impact the finish of the transparency. You can also tweak the strength of the transparency material directly both in the inspector and in code by just access the color component of the material and changing the alpha channel like below.

Coupled with a few snippets of code, you can have enemies fade away disappear then reappear in a new location and fade back into focus. This is also a great way to remove objects from a scene fading them out and then destroying them or reusing them using a pooling manager. The sky’s the limit and limited only to your imagination. Until next time, happy coding.