Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Bug ProBuilder objects in prefabs break if you call PrefabUtility.RevertPrefabInstance

Discussion in 'World Building' started by dgoyette, Nov 30, 2023.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    ProBuilder objects appear to have a major problem with calling PrefabUtility.RevertPrefabInstance to revert a prefab instance. This doesn't happen if you click "Overrides -> Revert All" in the inspector for the prefab. But calling PrefabUtility.RevertPrefabInstance with break the object.

    For example, I made a simple prefab containing a default PB cube:

    upload_2023-11-30_14-33-21.png

    Now, if I call PrefabUtility.RevertPrefabInstance too revert the TestObj prefab, this is the result:

    upload_2023-11-30_14-34-15.png

    The object disappears, there's now a strange [none] (Mesh Filter) object on the PB object, and both the PB Mesh Filter and the Mesh Collider has lost their reference to the Mesh.

    Now, although the object is "broken", it's recoverable. If I switch to a different scene and come back, the object will be restored. Or, I can select the object, switch to Vertex mode, and I can see the verts. If I move one of the verts, the object is restored:

    upload_2023-11-30_14-36-39.png

    Is there something you're expecting people to call on PB objects after calling PrefabUtility.RevertPrefabInstance? Is there some way to tell PB Objects to fix themselves?