Nerd For Tech
Published in

Nerd For Tech

Prefabs in Level Design

Objective: Use Unity’s Prefab system to create unique objects that can be used over and over in your scene.

A Prefab asset is like a blueprint the can be used to create instances of the same object over and over. A Prefab also allows you to change all the objects by just changing the Prefab object.

I will use a Prefab to create some unique floor tiles by combining two different objects. I have downloaded some Floor Assets and have chosen two that I want to use.

First I will create a folder under Assets called Prefab and a subfolder called Floor. This is where I will store the Prefab Object.

Creating Folders to store Prefabs

Next, I will combine the two floor objects and rename it New Floor

Creating the new Object

Now to turn this into a Prefab, all I need to do is drag it into the Prefabs folder and select Original Prefab in the popup message.

Creating a Prefab

Now that I have this tile setup as a Prefab, I can drag then into the Scene and I can also duplicate than to create a Floor.

Using the Prefab

One advantage of using a Prefab is that you can change just one object and have the changes updated to all the other objects. I will demonstrate below by changing the position of the raised element in the object and apply the changes.

Changing Prefabs

Happy Coding!!!!!

--

--

--

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

Recommended from Medium

Automate Your ESXi-VMs on a Free License

Room Persistence Library -Data Access Objects — Room database

Tiny Colony MVP Guide

From the Students’ Perspective

Weekly Digest 46/2021

CSS Animations — Translate vs Absolute Positioning and Background-Position

Remembering daapr

Contract Law in Utah

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Bill Rislov

Bill Rislov

Unity / C# Game developer

More from Medium

Design Pattern: Command

Calling Footstep Events from Animations

Creating the Main Menu

Unity Basics by making a project