Search Unity

GameObject with Two Transforms - Keeps Crashing Unity

Discussion in 'Editor & General Support' started by Zergling103, Jun 19, 2012.

  1. Zergling103

    Zergling103

    Joined:
    Aug 16, 2011
    Posts:
    392
    Somehow, when duplicating a GameObject, it mysteriously caused one of the children of the original to have two transforms, with different parents, thus causing it to appear twice in the hierarchy.

    This crashes unity. Crashes every time it runs in the editor, and presumably in game as well. I basically cannot touch the thing or else it crashes. I cannot delete it... and I cannot delete the extra transform (since someone conveniently grayed out that option for me; doesn't work with scripts either).

    Until this is fixed I cannot continue working on the level which was corrupted by this bug, and am faced with the possibility of starting over.

    Can you please add the following lines of code in your next update for 3.5?

    Code (csharp):
    1. Transform[] tf = gameObject.GetComponents<Transform>();
    2.  
    3. if(tf.Length > 1)
    4. {
    5.     for(int tfIndex = 1; tfIndex < tf.Length; tfIndex++)
    6.     {
    7.         DestroyImmediate(tf[tfIndex]);
    8.     }
    9. }
    Thank you,

    -Steve
     
    Last edited: Jun 19, 2012
  2. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    I have never heard of this behavior. Have you filed a bug report with this project attached?
     
  3. Zergling103

    Zergling103

    Joined:
    Aug 16, 2011
    Posts:
    392
    I've filed a bug report, but have not attached the project since I have yet to reduce it down to the bare minimum required to reproduce the bug (it is 17 GB and contains source code I don't feel comfortable distributing). I'll have that done by tomorrow since it's about 5 am right now. :p

    Interestingly enough, I can duplicate the gameObject with two transforms, and it's duplicate has two transforms as well. The duplicate however can be deleted without issues though. The duplicate references it's own unique Transforms, they're not just referencing the Transforms of the original. Weird!
     
    Last edited: Jun 19, 2012
  4. Zergling103

    Zergling103

    Joined:
    Aug 16, 2011
    Posts:
    392
    Here is a package containing a level with the faulty GameObject. I duplicated the faulty object, since the duplicate can be deleted while the original cannot - it causes a Unity crash.

    Let me know what you find out! :)
     

    Attached Files:

  5. Luisdiv

    Luisdiv

    Joined:
    Sep 17, 2012
    Posts:
    8
    I have this same issue. It made me lose all my work today :(

    Did it get resolved?? I can redo all my prefabs, but I have an object like that already on my Hierarchy which I can't delete because it crashes.

    http://imgur.com/ok3Zalr
     
    Last edited: Jan 25, 2013
  6. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    How the heck are you able to get a GameObject with two Transform components. This is definitely a bug of some sort. You should file a bug report with the project attached.

    As a workaround - any reason you can't simply delete that GameObject and create a new one? If you have a reproducible situation where every time you create a new GameObject you get two transforms, I'm sure the Devs would love to see it in action.
     
  7. Benoit Dufresne

    Benoit Dufresne

    Joined:
    Feb 26, 2013
    Posts:
    4
    Here's a screenshot of similar issue. The objects appears twice in hierarchy. It is not possible to select only one of them.

    Deleting them and remaking is not an option: any attempt to do anything with it will crash unity.

    Closing the scene will crash Unity.
    Impossible to copy objects in hierarchy to a new scene as two instances cannot be open at once and closing scene crashes unity - therefore clearing clipboard.

    Would there be a way to delete the object in hierarchy from the scene's source code?

    $two_transforms.png
     
    Last edited: Feb 26, 2013
  8. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Your image is not showing up. Can you try hosting the image on dropbox, tinygrab, skitch, or some other host? And then link it with the image button?

    If you can reproduce HOW you achieved this state it would be good. If not, try reporting this scene using the internal bug reporter.
     
  9. Rahkola

    Rahkola

    Joined:
    Sep 18, 2012
    Posts:
    2
    I had the same problem but my gameobject had two renderers. While this gameobject was on scene unity crached at anything. Even trying to create new project crashed unity. In my case the problem was almost on every scene because the problem was on prefab that was widely used in my project. I managed to overcome this problem by opening unity by opening a scene that didn't contain the "doublerenderer-object", deleting the entire prefab and creating it again. This solution works only with prefabs though.
     
  10. coquifrogs

    coquifrogs

    Joined:
    Jan 17, 2012
    Posts:
    16
    If you have assets written in text format you can open it in a text editor and ditch the second transform. Look for the GameObject with m_Name: middle4. Same thing goes for prefab assets if you have text serialization on.
     
  11. gooncorp

    gooncorp

    Joined:
    Dec 30, 2011
    Posts:
    131
    im having the same problem right now, this is driving me nuts. i have 2 nemesis transforms, one i dragged inside the other somehow and i cannot open my scene.
     
  12. dustingunn

    dustingunn

    Joined:
    Apr 23, 2012
    Posts:
    6
    Just got this bug after installing this http://forum.unity3d.com/threads/102765-Free-Inverse-Kinematics-script! (I noticed later I wasn't using the most recent one since the outdated one was attached to the prefab)

    I'm pretty sure the script that caused it was "ikLimb" since the object that got corrupted to have 2 transforms was the prefab with it. Deleting the script asset didn't help and my trying to save my scene has only made it worse since now I can't even open it.