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
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
On the other hand, if you want a realistic and functional windows, Unity has made it easy to implement them.
Step 1: Create or Modify a new Material
If you don’t have an existing Material, create a new one by
- Right-click in the Projects window
- Create on Create
- Click on Material
Step 2: Change the Rendering Mode
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
Step 3: Modify the Albedo
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.
Step 4: Apply the Material to the Object
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!