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!!!!!



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