yasirkula / UnityRuntimeInspector

Runtime Inspector and Hierarchy solution for Unity for debugging and runtime editing purposes
MIT License
1.75k stars 139 forks source link

fixed: dropping hierarchy item on pseudo scene creates duplicates #39

Closed i-xt closed 3 years ago

i-xt commented 3 years ago

How to replicate the issue:

  1. Create a runtime hierarchy with a pseudo scene
  2. Add 2 GameObjects to the pseudo scene
  3. In the runtime hierarchy, drag one of the displayed items onto the other one to create a child
  4. Drag the child back on the pseudo scene

Result: The hierarchy displays the dragged item twice, because the Transform is added to the pseudo scene, but not re-parented. This also happens when moving items between pseudo scenes.

yasirkula commented 3 years ago

Changing an object's parent when it is dropped onto a pseudo scene is not something I like because pseudo scenes aren't tied to any Transform. By default, adding Transforms to pseudo scenes isn't even allowed. When it is allowed by enabling "Can Add Objects To Pseudo Scenes" option of "Hierarchy Drag Drop Listener", duplicate root entries are still not allowed. No matter how many times I drop object A onto pseudo-scene B, object A is added to the pseudo scene only once. So there aren't any duplicates created.

i-xt commented 3 years ago

Maybe we could find a different solution then. What do you think should happen when de-parenting inside a pseudo scene? Having the object as a child of another object in the pseudo-scene and as a root object in the pseudo-scene at the same time seems weird to me.

yasirkula commented 3 years ago

I'm actually happy with that 😄 The current state is as straightforward and bug-free as it can get.

i-xt commented 3 years ago

Just to avoid miscommunication, this is the behavior I'm referring to:

DragDrop

yasirkula commented 3 years ago

Yes, I know. It is allowed to have both GameObject (1) and GameObject (3) at the root of the same pseudo-scene and I am happy with this behaviour.

i-xt commented 3 years ago

Alright, thanks for the clarification 👍 I'll close the PR then.