class PrefabUpdateHelper

Helper class that updates a prefab from scene object hierarchy, and makes sure the scene object hierarchy has correct prefab links to the prefabs that were updated.

Public

Methods

staticUpdatePrefab

static void UpdatePrefab(const HPrefab &prefabToUpdate, const HSceneObject &sceneObjectToUpdateWith)

Updates the provided prefab resource so it stores a copy of the provided scene hierarchy.

Provided scene hierarchy is made to be an instance of the prefab, if not already an instance of the provided prefab, or any other prefab. All other currently loaded instances of will be updated to match the updated hierarchy.

Private

Methods

staticFindInstanceInPrefab

static TOptional<ObjectInPrefab> FindInstanceInPrefab(const GameObjectHandle &gameObject, const UUID &prefabResourceId)

Looks up a counterpart of the provided game object in the specified prefab.

Under the hood loads the prefab as required.

staticFindInstanceInPrefab

static TOptional<ObjectInPrefab> FindInstanceInPrefab(const HSceneObject &sceneObject)

Looks up a counterpart of the provided scene object in the prefab it is an instance of.

Under the hood loads the prefab as required.

staticFindInstanceInPrefab

static TOptional<ObjectInPrefab> FindInstanceInPrefab(const HComponent &component)

Looks up a counterpart of the provided component in the prefab it is an instance of.

Under the hood loads the prefab as required.

staticFindInstanceIdsThatNeedRemapping

static UnorderedMap<UUID, UUID> FindInstanceIdsThatNeedRemapping(const HSceneObject &root)

Iterates the provided hierarchy and for each object visits the prefab resource as referenced by the object.

If the visited object itself contains a prefab link, its prefab resource is visited as well, recursively. Returns the game object ID within the last prefab that is referencing the object, excluding the prefabs that own the object (cases where object links to its own prefab).