Class ObjectPathRemapper
The ObjectPathRemapper is used to track GameObject movement in the hierarchy, and to update animation paths accordingly. While the ObjectPathRemapper is active, there are a few important rules around hierarchy and animation maniuplation that must be observed.
- The ObjectPathRemapper takes a snapshot of the object paths that were present at time of activation;
as such, any new animations added while it is active must use those paths, not those of the current
hierarchy. To help with this, you can use the 
GetVirtualPathForObjectmethod to get the path that should be used for newly generated animations. - Objects can be moved freely within the hierarchy; however, if you want to remove an object, you must call
ReplaceObjecton it first. - Objects can be freely added; if you want to use those objects in animations, use 
GetVirtualPathForObjectto get the path that should be used. This will automatically register that object, if necessary. If you'd like to use animation clips with pre-existing paths on, for example, a newly instantiated prefab hierarchy, useRecordObjectTreeto ensure that those objects have their current paths recorded first. This ensures that if those objects are moved in later stages, the paths will be updated appropriately. Note that it's possible that these paths may collide with paths that previously existed, so it's still recommended to useGetVirtualPathForObjectto ensure that the path is unique. 
public sealed class ObjectPathRemapper
  - Inheritance
 - 
      
      ObjectPathRemapper
 
- Inherited Members
 
Methods
ClearCache()
Clears the path remapping cache. This should be called after making changes to the hierarchy, such as moving objects around.
public void ClearCache()
  GetObjectForPath(string)
Returns the GameObject corresponding to an animation path, if any. This is based on where the object was located at the time it was first discovered, not its current location.
public GameObject? GetObjectForPath(string path)
  Parameters
pathstring
Returns
- GameObject?
 
GetVirtualPathForObject(GameObject)
Returns a virtual path for the given GameObject. For most objects, this will be their actual path; however, if that path is unusable (e.g. another object was previously at that path), a new path will be generated instead.
public string GetVirtualPathForObject(GameObject obj)
  Parameters
objGameObject
Returns
GetVirtualPathForObject(Transform)
Returns a virtual path for the given Transform. For most objects, this will be their actual path; however, if that path is unusable (e.g. another object was previously at that path), a new path will be generated instead.
public string GetVirtualPathForObject(Transform t)
  Parameters
tTransform
Returns
GetVirtualToRealPathMap()
Returns a dictionary mapping from virtual paths (ie - those currently in use in animations) to the corresponding object's current paths. Deleted objects are represented by a null value.
public Dictionary<string, string?> GetVirtualToRealPathMap()
  Returns
RecordObjectTree(Transform)
Ensures all objects in this object and its children are recorded in the object path mapper.
public void RecordObjectTree(Transform subtree)
  Parameters
subtreeTransform
ReplaceObject(GameObject, GameObject)
Replaces all references to old with newObject.
public void ReplaceObject(GameObject old, GameObject newObject)
  Parameters
oldGameObjectnewObjectGameObject
ReplaceObject(Transform, Transform)
Replaces all references to old with newObject.
public void ReplaceObject(Transform old, Transform newObject)
  Parameters
oldTransformnewObjectTransform