Search Unity

Bug Possible issue with Editor Hangups, Enter/Exit Playmode, and PreFabs/ProBuilder (With workaround)

Discussion in 'Editor & General Support' started by CSNomadProductions, May 27, 2021.

  1. CSNomadProductions

    CSNomadProductions

    Joined:
    Mar 4, 2020
    Posts:
    12
    So I posted this in a different thread, but figured It would go well here in General/Editor in case some people were having the same issue.

    The TL;DR of the issue is that, in certain instances, using relatively simple pre-fabs in an almost empty scene will cause the Editor to hang for anywhere from 1-2 minutes to over 10-15 minutes. Often this is accompanied by a dialogue box with 'Application.Tick' or similar.

    I can reliably recreate this issue by taking a pre-fab, lets say a generic wall asset for making a room, placing multiple instances of that pre-fab inside a new pre-fab, say like a whole room, then using Pro-Builder's 'Merge Objects' feature, try to merge several wall pre-fab objects into one.

    Depending upon the complexity of the merged objects, this step can take several minutes, but that's kind of expected when merging. In theory, this is meant to save time as the engine has to load fewer assets at a time.

    Where the issue seems to start to creep in is if you try to use Pro-Builder to modify these merged objects that were once their own pre-fabs. When you do that, you may start to notice the Editor lag substantially. The more extensive the modifications, the greater the lag.

    I think this deals with how PB handles merging objects, as whenever I used this feature, It seemed to have a hard time figuring out which parts of the multiple objects were meant to be the 'true surface' to re-calculate normals and such.

    For example, I one time merged ALL of my wall assets in a boss room into one 'super wall' object. This took the better part of 10 minutes. When PB finished the merge, my normals were all sorts of wonky and it was showing the back side parts as the 'surface' in some areas, and the opposite in other sections. So whenever you modify the mesh, PB has to recalculate off these Normals again.

    Another note-worthy observation, if I were to stack 3 wall segments and 'merge-objects' them, the editor would lag for a second or so every time I duplicated this merged object with 'Ctrl+D'. HOWEVER, if I kept the 3 wall pre-fabs separate, but selected all three for duplication, there would be no issue/lag/hang ups.



    My theory is if you use such an asset with these 'merged-object-pre-fab' things, I think Unity recalculates the Normals for each instance of the asset every time you enter/exit play mode.

    CURRENT 'FIX': So unfortunately, it seems the only way to rectify this to go into the prefab and delete all merged objects that use pre-fabs. I know it's not perfect, but I hope this helps some people save at least some work. (Not to mention some hair-ripping frustrations)
     
    JauntyBearGames likes this.
  2. JauntyBearGames

    JauntyBearGames

    Joined:
    Mar 26, 2018
    Posts:
    57
    same issue here and killing our workflows; I'm now trying to remove my dependencies with PB
     
  3. CSNomadProductions

    CSNomadProductions

    Joined:
    Mar 4, 2020
    Posts:
    12
    Supposedly unpacking then repacking the Pre-Fab fixes this issue, but I'm just avoiding PB Merge to prevent any other headaches that might crop up.
     
  4. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    I'm having the same issue, but without even installing ProBuilder... I just deleted a child object (nothing special just a regular sphere, with no scripts attached) from a prefab, and after that Unity hanged up every time I tried to enter play mode. The only way to get out of that loop was by changing something in the prefab to force it to be saved it again.