Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

ModelImporter.transformPaths broken in Unity 2018.3.3? Always returns empty list.

Discussion in 'Extensions & OnGUI' started by jashan, Jan 31, 2019.

  1. jashan


    Mar 9, 2007
    We're using a custom AssetPostprocessor to automate setting up ModelImporter.extraExposedTransformPaths. The way we do this is by iterating over ModelImporter.transformPaths, checking for names and then assigning the resulting list to ModelImporter.extraExposedTransformPaths.

    This worked flawlessly until Unity 2018.2.20f1. Now, after upgrading to Unity 2018.3.3, transformPaths always returns an empty list and our asset post processor breaks.

    The transforms are shown correctly in the inspector UI, with fancy checkbox-tree.

    I've tried several things to fix / work around this issue: Moved the code from OnPreprocessModel() to OnPostprocessModel(), set dragonImporter.optimizeGameObjects to false ... but so far, no matter what I do, transformPaths always is an empty list.

    Any ideas what is the issue with this, and how I can solve it?
  2. Azura


    Feb 21, 2013
    I'm also running into this issue, it seems that no matter what I do I always get back an empty transformPaths property.
  3. jashan


    Mar 9, 2007
    It turns out they have changed this "by design" because transformPaths always returned the list from the previous import (I had filed this as (Case 1124508) Regression 2018.2 to 2018.3: ModelImporter.transformPaths is empty).

    It's a bit of a hassle to fix this, but here's some rough example code to get you started:

    Code (CSharp):
    1.     public void OnPostprocessMeshHierarchy(GameObject root) {
    2.         // only do this for the rig:
    3.         if ("YourRigRootNodeName")) {
    4.             List<string> paths = new List<string>();
    5.             BuildTransformPaths(paths, root.transform);
    6.             string[] transformPaths = paths.ToArray();
    8.             // AssignExposedTransformPaths can now be implemented
    9.             // like OnPreprocessModel used to be
    10.             //AssignExposedTransformPaths((ModelImporter)assetImporter, transformPaths);
    11.         }
    12.     }
    14.     private void BuildTransformPaths(List<string> paths, Transform transform) {
    15.         List<string> currentPath = new List<string>();
    16.         Transform current = transform;
    17.         currentPath.Add(;
    18.         while (current.parent != null) {
    19.             current = current.parent;
    20.             currentPath.Add(;
    21.         }
    22.         currentPath.Reverse();
    23.         paths.Add(string.Join("/", currentPath.ToArray()));
    24.         foreach (Transform child in transform) {
    25.             BuildTransformPaths(paths, child);
    26.         }
    27.     }