Search Unity

Change to PrefabUtility.DisconnectPrefabInstance() breaks it all

Discussion in 'Prefabs' started by Kronnect, Nov 28, 2018.

  1. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Hi,

    PrefabUtility.DisconnectPrefabInstance() has been deprecated in a way that it no longer does nothing in Unity 2018.3+:



    This change is breaking some Editor Extensions which just instantiate a prefab and immediately break the link to it to allow independent instances in the scene.

    Can't just the API importer replace PrefabUtility.DisconnectPrefabInstance by this:

    Code (CSharp):
    1. PrefabUtility.UnpackPrefabInstance(gameObject, PrefabUnpackMode.Completely, InteractionMode.AutomatedAction);
    It seems to do the same thing.
     
  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Hi. UnpackPrefabInstance does indeed solve some uses cases that DisconnectPrefabInstance was used for before, but it's sufficiently different than we don't consider it safe to just replace one with the other.

    With disconnected Prefabs, you could reconnect again by applying or reverting. With unpacked Prefab instances you can't, since they are no longer Prefab instances at all and don't know what Prefab they used to be connected with.
     
  3. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Can't you keep current or approximate current implementation and mark it as Obsolete instead for some grace time?

    Generally speaking, this kind of breaking changes to fundamental features of Editor without providing a deprecating warning and a migration period is going to give lot of headaches to an unknown number of assets in the Asset Store that rely on current implementation.
     
  4. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Yes, we understand there are some pains in relation to fundamental changes in a core system in Unity and we've had much deliberation over which trade-offs to make. We support existing disconnected Prefabs in upgraded projects so that existing content doesn't outright break, but we can't support breaking new Prefabs in 2018.3 since it's incompatible with nesting and Variants.

    We've had a public release with the new Prefab features as far back as 5 months ago to give you all (including Asset Store publishers) time to find issues and resolve things on your end and/or report to us. By now, 2018.3 has been closed off for more changes before release so even if we accepted the risk of letting users corrupt their project by continuing to be able to create disconnected Prefabs and use them together with the new Prefab features, it would still be too late at this point to make the change.