Game Development Reference
In-Depth Information
Creating the MapPoint prefabs for reuse
Creating prefabs is very easy; just start creating a game object as you would do normally
and once you are happy with the result, drag the whole object to the project view. The
beauty is that just about anything can become a prefab for reuse in your game.
Note
When you create a prefab and use it in your scene, any changes to the prefab will be auto-
matically updated on all the objects you created with that prefab. However, changes to
those objects themselves do not update the prefab or any other copies. All changes are one
way from the prefab itself.
If you want to update the prefab, select the Prefab option in the editor and change it. Al-
ternatively, select an instance in the scene, change the required properties, and then click
on Apply to save the changes back to the prefab, as shown in the following screenshot:
This will only affect existing components and properties that were already on the prefab.
To add new components or scripts to the prefab, you must edit the prefab itself.
The following screenshot shows a game object setup for a place of interest on our map as
an empty game object with a simple BoxCollider2D component (set as a trigger). We
can also see the NavigationPrompt script we used in earlier chapters to bring up the
traveling GUI.
Search WWH ::




Custom Search