Transparency in Unity

Seeing through the windows; Source; This Old House

Generally, unless there’s an object obstructing the view, you are meant to see through a window. This mean when creating windows in Unity, the player should see what’s on the other side. However, Unity doesn’t do this by default due to the engine not knowing if the object is transparent or not. As a result, there are a couple of ways to overcome this limitation.

First Implementation: Obstruct the view

Windows are there, but can’t see through; Source: Cities Skylines

If the windows are blocked by something, that means the player can’t view the other side, and thus overcoming the issue, albeit in a different manner. Not only is this simple, but it’s also efficient: you can implement anything from curtains to a pre-rendered background to a simple color block and you’ve created a window without the need of creating transparency.

However, creating real transparency can go a long way, and for some buildings, having something blocking the windows is not ideal or even immersion-breaking.

Second Implementation: Creating Transparency

Left: Regular Material applied; Right: Transparent Material applied

On the other hand, if you want a realistic and functional windows, Unity has made it easy to implement them.

If you don’t have an existing Material, create a new one by

  1. Right-click in the Projects window
  2. Create on Create
  3. Click on Material

Selecting the Material you want to modify, access its properties in the Inspector Window.

Near the top, there’s a option called Rendering Mode and a dropdown menu next to it.

Clicking on the dropdown menu, select Transparent for the Material’s Rendering Mode

With the Material’s properties still listed in the Inspector Window, click on the color next to the Albedo option.

Once the Color Picker Window pops up, modify the Alpha, which is represented with the letter A.

When modifying the Alpha, the closer the number gets to 0, the more transparent the Material gets. However, I recommend setting it to 50 to give it a transparent, but not invisible look.

After modifying the Alpha, if the Material isn’t already on the glass panel, simply drag the Material onto the glass panel and viola, the window is now transparent!

Peeking through the window of a museum