Helper class for transform path operations during GLB import. More...
Static Public Member Functions | |
| static Transform | FindChildByRelativePath (Transform root, string path) |
| Finds a child transform by relative path from root. | |
| static string | BuildPathFromRoot (Transform root, Transform target) |
| Builds the hierarchical path from root to target transform. | |
| static Transform | FindContentRoot (Transform current, int maxDepth=10) |
| Finds the actual content root by traversing down through empty wrapper objects. | |
| static GameObject | RemoveWrappers (GameObject root, bool preserveWorldPosition=true) |
| Removes wrapper GameObjects (empty parents created by UnityGLTF) and returns the actual content root. | |
Detailed Description
Helper class for transform path operations during GLB import.
Provides utilities for finding transforms by path and building hierarchical paths.
Member Function Documentation
◆ BuildPathFromRoot()
|
static |
Builds the hierarchical path from root to target transform.
- Parameters
-
root The root transform target The target transform
- Returns
- The path from root to target as a slash-separated string
◆ FindChildByRelativePath()
|
static |
Finds a child transform by relative path from root.
Tries multiple strategies: direct find, root-stripped path, and recursive search.
- Parameters
-
root The root transform to search from path The relative path to find
- Returns
- The found transform, or null if not found
◆ FindContentRoot()
|
static |
Finds the actual content root by traversing down through empty wrapper objects.
UnityGLTF creates "Scene" wrapper objects that need to be skipped for reference resolution. Wrapper = only has Transform and optionally InstantiatedGLTFObject.
- Parameters
-
current The starting transform (typically the imported root) maxDepth Maximum depth to traverse (prevents infinite loops)
- Returns
- The actual content root transform
◆ RemoveWrappers()
|
static |
Removes wrapper GameObjects (empty parents created by UnityGLTF) and returns the actual content root.
The content root is unparented and wrappers are destroyed. IMPORTANT: This method preserves InstantiatedGLTFObject components by moving them from the wrapper to the content root before destruction, preventing mesh data from being garbage collected.
- Parameters
-
root The root GameObject (may include wrappers) preserveWorldPosition Whether to preserve world position when unparenting
- Returns
- The actual content GameObject with wrappers removed