Search Unity

Editor and player crash after reparenting a RectTransform

Discussion in 'UGUI & TextMesh Pro' started by samizzo, Apr 23, 2017.

  1. samizzo

    samizzo

    Joined:
    Sep 7, 2011
    Posts:
    487
    I'm seeing a reproducible crash when reparenting a RectTransform. I think it might be similar to this crash:
    https://issuetracker.unity3d.com/is...er-when-game-object-is-given-different-parent

    What I'm doing is as follows:

    1. Level select scene loads.
    2. Reparent a UI hierarchy from a DontDestroyOnLoad Canvas to the canvas in the level select scene.
    3. Level select scene fades in by animating a CanvasGroup alpha - the CanvasGroup is a parent of the hierarchy from (2).
    4. When the player taps on a level in the level select screen, the CanvasGroup fades out.
    5. When the fade out is complete, the UI hierarchy from (2) is reparented to the DontDestroyOnLoad Canvas.
    6. A new scene is loaded asynchronously.

    Right before I do the reparenting, I set the root GameObject of the UI hierarchy to active/inactive, and that's where it crashes.

    This has only started happening after I upgraded my project from 5.4.3f1 to 5.6.0.f3. It's a big problem because we're planning on releasing our game soon, and this is a major roadblock right now.

    I've reported a case here. Has anyone seen this crash, or does anyone have a workaround? I haven't been able to find a consistent workaround yet.

    I haven't been able to recreate it in a blank test project yet, because I'm not exactly sure what the conditions are that are causing it, and I don't have the time right now to carefully pull the game apart to work it out.

    Thanks,
    Sam
     
    Last edited: Apr 24, 2017