Creating an NPC
As stated earlier, NPC stands for Non-Player Character and typically refers to any friendly or neutral characters other than the player-controlled character. In our adventure, Level three will feature an NPC character standing outside their house, who will provide us with a quest to collect a gem from Level two. To create the NPC character, we'll duplicate the player and adjust the character color, making them appear distinct:
- Drag and drop the
Player
prefab from the Project panel to theLevel02
scene and position it near the house area: - Name the object
NPC
. - To prevent any changes we make to the
NPC
object to propagate back to the prefab, remove the association between the two by right-clicking on the object and selecting Prefab | Unpack Completely.Important note
Prefabs are discussed in detail in Chapter 1, Exploring the Fundamentals of Unity.
- Remove all additional components...