Prefab Instance Component: Difference between revisions

From Pummel Party Mod Documentation
Jump to navigation Jump to search
(Wording updates on adding component and its restrictions)
(Added image and more content)
Line 1: Line 1:
[[File:PrefabInstanceComponent.png|thumb|right|500px|The Prefab Instance component in the [[Inspector Window]]. The '''Edit Prefab''' button opens the current prefab asset for editing.]]
The prefab instance component is a [[:Category:Gameplay Components|gameplay component]] that creates an instance of a given [[Prefab Asset]].
The prefab instance component is a [[:Category:Gameplay Components|gameplay component]] that creates an instance of a given [[Prefab Asset]].
This is the primary way to use prefabs. The benefit of prefabs is to create the prefab once and use it many times throughout the scene without manually duplicating all objects within the prefab. Using prefabs with the Prefab Instance component allows you to make many prefab instances which all point to the same prefab asset. This means if the prefab asset changes, all prefab instances will update automatically.


Prefab Instance components cannot be added to gameobjects that have child gameobjects in the hierarchy. They must be added to an empty gameobject that has no other components attached.
Prefab Instance components cannot be added to gameobjects that have child gameobjects in the hierarchy. They must be added to an empty gameobject that has no other components attached.

Revision as of 00:22, 8 December 2022

The Prefab Instance component in the Inspector Window. The Edit Prefab button opens the current prefab asset for editing.

The prefab instance component is a gameplay component that creates an instance of a given Prefab Asset.

This is the primary way to use prefabs. The benefit of prefabs is to create the prefab once and use it many times throughout the scene without manually duplicating all objects within the prefab. Using prefabs with the Prefab Instance component allows you to make many prefab instances which all point to the same prefab asset. This means if the prefab asset changes, all prefab instances will update automatically.

Prefab Instance components cannot be added to gameobjects that have child gameobjects in the hierarchy. They must be added to an empty gameobject that has no other components attached. While a prefab instance component is attached to a gameobject, that gameobject cannot have any child gameobjects added, cannot have any more components added and will be given a unique icon and color in the hierarchy.