

InstantiatingPrefabsExamples.zip Basics of instantiating a Prefab Note: You can download a Unity Project containing all the examples on this page, here:

You can make a simple rocket into a super-charged rocket, without any code changes. Set up, test, and modify the Prefab quickly and easily using the Scene view, Hierarchy and Inspector.Ĭhange which Prefab is instantiated without changing the code. Creating equivalent GameObjects from scratch requires many more lines of code. Instantiate a Prefab using one line of code. Compared with creating GameObjects from scratch using code, instantiating Prefabs using code has many advantages because you can: Prefabs come in very handy when you want to instantiate complicated GameObjects or collections of GameObjects at run time.
