Search Unity

bug 1098458 : new prefab is having trouble tracking nesting and mistakes it for children reordering

Discussion in 'Prefabs' started by laurentlavigne, Nov 6, 2018.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,362
    repro:
    1. create prefab1 and prefab2
    2. drag prefab2 under prefab1
    3. override prefab1
    4. then unpack prefab1 and unparent prefab2 (I hope this is a temporary solution as it should be done with drag and drop)
    5. drag the now broken-link prefab1 into the project prefab1 to relink (a relink button would be good)
    6. finally drag prefab2 again in prefab1
    even though 6 is the same operation as 2, now prefab misunderstands parenting a new child with a moving children
    upload_2018-11-6_13-40-2.png
     
  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Hi,

    I can't repro here, neither with the steps you posted here or the different steps you wrote in the bug report. For me, all steps complete without showing any dialog. But QA is yet to have a look; they will attempt to repro it too.

    I had to make some assumptions. When you say "override prefab1" I assume you mean "Apply all overrides on prefab1"? I assume this since you didn't specify which property to override, and you say that dragging Prefab1 back out isn't possible without unpacking, which is only true if you applied overrides after dragging Prefab2 under Prefab1.

    If that is indeed the case, I'd recommend saying "apply overrides" in the future if you want to avoid misunderstandings. Normally to "override" a property is to make that property overridden; not to apply an override.

    Another things to note is that a Prefab is no longer a Prefab after unpacking. It's not a "now broken-link Prefab"; it has no information about what Prefab it came from before unpacking. It's just regular GameObjects. 2018.3 does not have support for disconnecting Prefabs, since it's incompatible with the new Prefab features.

    Finally, using bug reports to call for developers to be "reassigned" is not constructive and will not achieve anything. But we are still taking the bug report serious aside from that, of course.
     
    laurentlavigne likes this.
  3. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    559
    with normal game objects, you can drag a go under a new parent but before its other children (@runevision note the blue line (as opposed to full border) in the screenshot).
    if you try to do that with a prefab (regardless of unpacking/repacking/overriding stuff - just create a prefab with a child) you get the 'cannot restructure' popup: the existing children will "move down a sibling index"
     
    laurentlavigne likes this.
  4. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Right. You can't insert an added child in between children that are part of the Prefab; it has to be added at the end. With dragging, this can be done either by dragging onto the end, right after the last child, or into the parent.

    The image from Laurent does show a blue line in a spot where it's not possible to add children, but I can't see from the repro steps how that situation arises. I'm not seeing dragging an object into a Prefab with existing children based on those steps. Maybe I'm missing something.
    Edit: The steps posted here in the forum should not be able to produce the situation but the more complex steps in the bug report can. The difference is not about the two cases being compared in the bug report though; it's between where the object is dragged to (in between existing children, or at the end/on the parent).
     
    Last edited: Nov 7, 2018
    laurentlavigne likes this.
  5. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    559
    I assumed @laurentlavigne tried to insert the child before the sibling from the screenshot, and that triggers the popup. idk if it's something else (popup also appearing when you add as last sibling after something gets messed up)
     
    laurentlavigne and runevision like this.
  6. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,362
    Good eye! Eagle eye!
    You are right!
    I didn't pay attention to where I was dropping the prefab because this used to be ok and I thought neoprefab only forbids re-structuring, the sort of stuff that used to break prefabs.
    One more limitation to kick my workflow in the nuts, so I'd love to know more, might soothe the pain.
    Here is my understand and maybe you can correct that:
    parenting: references to children transforms are packed in an array in the parent.
    transform.children[0] = rifai.transform.
    If Mr Bubble is inserted as [0] then rifai.transform is moved to [1] (I assume with the C++ equivalent of Array.Insert)
    Also overrides store data that's changed, and this data include references as well as arrays.
    What I'm having trouble understanding is why isn't neoprefab handling Transform[] transform.children in the same way as public Transform[] trans, by just storing the new array of children transform as override?

    That's a shame because that was a convenient workflow. Is there a replacement workflow to it? Also, why incompatible? I didn't find an explanation in the FAQ. It seems that you guys can decide to put anything you want in a scene data, including history of what a gameobject was linked to.

    I respectfully disagree: bringing in a new gui dev onboard prefab would at least bring in new fresh perspective. If not reassignment of the current gui-dev, which I understand can be traumatic for the person - that's maybe what you're reacting to - at least give this a try: bring in a new gui dev on the prefab team and let him try out a few things that are strictly user centric.
     
  7. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Because it's ambiguous how the list should be merged if you rearrange it in an instance, and then open the Prefab and rearrange it there too. Some references could get entirely lost that way. public Transform[] arrays have the same issue but is not considered as critical so we don't have the same integrity checks there.

    Editing Prefabs in Prefab mode is the replacement. Naturally, since it's a rather different workflow, it has various advantages and disadvantages compared to disconnecting Prefabs.

    Incompatible because disconnected Prefabs don't have a clear definition of what belongs and doesn't belong to the same Prefab instance, and it's necessary to have clear definitions of that when also supporting nested Prefabs and Variants in order for all the logic that manages the various Prefab relationships to work.

    When I said that it will not achieve anything, that's not a matter of opinion for you to disagree with; it's just how things are. We welcome all feedback about our product and services. Feedback about how we structure our teams internally and who should be assigned to what is misplaced and not any of your business. Please respect that.
     
  8. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,362
    I've run a few examples and none of them lost reference or become ambiguous for the user, can you give one that does that?
    Here is an example:
    instance's children order 0,1,2 is changed into 0,2,1 then prefab 0,1,2 is changed into 2,1,0
    If instance children order override is stored as child index # then yes the instance will turn into 1,2,0 which will be very confusing for the user but if instance override children order orverride is stored as guid of the transform then the change in the prefab gets completely overriden by the instance which is what I'd expect from the term override.
     
  9. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Here the first element 0 is not overridden on the instance but the next two (2,1) are: 0,2,1

    This means only the first element will inherit the change from the Prefab Asset: 0 becomes 2.

    The final order is: 2,2,1

    The reference to 1 got lost entirely on the instance and instead you have two references to 2.
     
  10. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,362
    I ran this test using nested prefab and there is no such problem.
    source:
    upload_2018-11-30_22-18-11.png
    shuffle the instance
    upload_2018-11-30_22-17-38.png
    shuffle the prefab then apply
    upload_2018-11-30_22-18-54.png
     

    Attached Files: