Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

PB Meshes don't play nicely with Improved Prefab workflow?

Discussion in 'World Building' started by dgoyette, Dec 18, 2018.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,057
    Is it necessary to enable the "experimental" Meshes as Assets feature in order for PB objects to behave cleanly in prefabs under 2018.3? By "cleanly", I mean that currently every prefab instance I have that contains a PB object considers itself to have overrides, because the Mesh is different. For example:

    upload_2018-12-18_10-48-50.png

    No matter how many times I Apply or Revert these overrides, they remain overrides. If I go into Prefab mode, the actual prefab has a different Pb_mesh-xxxx ID.

    I'm hesitant to enabled an "Experimental" PB feature though, especially as I don't know anything about it, or whether there's a better way for PB objects not to act like overrides in prefabs.
     
  2. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    957
    Hi! No need to enable the experimental option, it will work fine. Just looks a little strange for now, sorry!
     
  3. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,057
    Thanks. Meaning that in some future release of Unity or ProBuilder, Unity will stop telling me that my prefab instance containing PB meshes has overrides due to the PB mesh?
     
  4. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    957
    Yep, precisely :)
     
    dgoyette likes this.
  5. jonagill_rr

    jonagill_rr

    Joined:
    Jun 21, 2017
    Posts:
    54
    @gabrielw_unity Can you elaborate on what's happening here? We are seeing issues handling prefabs and prefab instances using Unity 2018.3.5 and ProBuilder 4.04.

    It appears that ProBuilder is aggressively regenerating meshes across instances of prefabs, even if they should share the same mesh as the prefab asset. The repro is very simple: create a new PB cube mesh and make it a prefab. Then drag that prefab into a scene. Notice that the mesh on the instance is different than the mesh on the asset, and the instance has been flagged as having an override

    This happens whether or not Meshes are Assets is checked. This is odd to me since, digging through the the ProBuilder package source, it appears that Meshes are Assets should be causing ProBuilder to attempt to cache and re-use the same mesh across instances and assets.

    This is causing one major issue for us currently, and I'm worried it may be less obviously causing several more.

    The obviously apparent issue is that loading a scene containing large ProBuilder meshes takes freaking forever, spending multiple minutes in a call to Prefabs.MergePrefabs() from LoadLevelAsync() -- my guess is that all the meshes are being regenerated during deserialization, causing extremely long hangs.

    The other issues I'm concerned about are purely hypothetical, but I'm guessing that this could be bloating our application's memory budgets at runtime. If we have 100 instances of the same ProBuilder prefab, will we be generating 100 identical meshes to store in memory?


    If you're able to shine any light on what is happening here and what possible workarounds are, I'd be very grateful. Right now I don't know if we're running into a bug, or if we're just misunderstanding the way in which ProBuilder is intended to be used. The repro steps I mention feel extremely broken to me, but it's possible I'm just confused about what is happening under the hood.
     
  6. jonagill_rr

    jonagill_rr

    Joined:
    Jun 21, 2017
    Posts:
    54
    One of my coworkers just build a min repro project that confirms that the issue still occurs on 2018.3.10. In the min repro project, it's really apparently that we're just generated new meshes all over the place -- every time you drag the Cube prefab into a scene, you can see a new mesh asset generated on-disk and added to the ProBuilderMeshCache folder.
     

    Attached Files:

  7. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    957
    Hi! Yep, we see this problem and are working toward a solution. It's not a quick one, unfortunately. You can use the experimental "Meshes are Assets", if you like - in fact it'd be great to hear how that works for you! :)
     
  8. jonagill_rr

    jonagill_rr

    Joined:
    Jun 21, 2017
    Posts:
    54
    "Meshes are Assets" works pretty poorly for us. :p It does the same 'generate meshes all the dang time' behavior, with the added fun of writing a new asset to disk and incurring the file I/O costs.

    We've ended up writing our own code to build out the generated mesh to our own asset cache and delete the ProBuilderMesh script entirely when we're not actively editing the meshes. It's a little gross, but it means our scenes load in 5-10 seconds instead of the 10 minutes it was taking before.
     
  9. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    957
    Hi, can you clarify "generate meshes all the dang time"? With "Meshes are Assets" (MaA), a new mesh should only be generated once, when the object is created. Are you seeing something different? Thanks!
     
  10. jonagill_rr

    jonagill_rr

    Joined:
    Jun 21, 2017
    Posts:
    54
    Correct. The simple repro was:

    - Make a Probuilder cube
    - Make it a prefab (drag it into the project view)
    - Drag that prefab into the scene to create an instance
    - Look at the instance in the inspector and note that it has generated a new mesh asset and overridden the prefab mesh references

    Looking at Probuilder's code, it looks like it attempts to reuse the same mesh across prefab assets and instances if Meshes are Assets is enabled, but for some reason that was not working properly for us.
     
  11. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    957
    Ah, ok - got it, found it, logging a bug now. Thanks for the info!
     
  12. jonagill_rr

    jonagill_rr

    Joined:
    Jun 21, 2017
    Posts:
    54
    Thanks for looking into it!
     
  13. wbd_lludo

    wbd_lludo

    Joined:
    Jan 14, 2019
    Posts:
    1
    Hi everybody !

    Is this issue resolved ? Because i have the same problem here. :/

    @gabrielw_unity
     
  14. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    957
    Hi wbd_lludo - which issue are you referring to? :)
     
  15. noethis

    noethis

    Joined:
    Nov 11, 2013
    Posts:
    128
    Is there an ETA on fixing the original problem mentioned in this thread--namely prefabs always thinking PB objects have overrides? It's making it hard to maintain prefabs and whether they're up to date.
     
  16. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    537
    Yes, a PR just landed addressing this issue as well as other prefab related bugs.

    https://github.com/Unity-Technologies/com.unity.probuilder/pull/221

    The fix is first appearing in ProBuilder 4.3.0-preview.2, which should be available within a few hours in Package Manager (make sure you have "Preview Packages Enabled" toggled to "On" to see the update).
     
    dgoyette likes this.
  17. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,057
    This is good to hear. I'll check out 4.3.0-preview.2 when I see it.
     
  18. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,057
  19. noethis

    noethis

    Joined:
    Nov 11, 2013
    Posts:
    128
    So I tried 4.3.0-preview2 this morning but it doesn't appear to have addressed the prefab override issue yet. Here's what I'm seeing for overrides. Going inside the prefab and saving it doesn't help, as well as applying all changes or reverting all changes.

    Capture.PNG
     
  20. noethis

    noethis

    Joined:
    Nov 11, 2013
    Posts:
    128
    Also it looks like w/ 4.3pr2 when I make a windows build all my probuilder geometry disappears. Possibly related to the mesh filter change?
     
  21. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    537
    Yes, that's possible. If you have the time could you please file a bug report?
     
  22. noethis

    noethis

    Joined:
    Nov 11, 2013
    Posts:
    128
    Disabling "Script Stripping" ended up being my temp fix for the build issue.

    Another issue I came across is mesh colliders stop working because they can no longer find a mesh on the probuilder object. I think this might be due to the probuilder update migration, since creating a new probuilder object has a proper mesh reference on the mesh collider.

    EDIT: Submitted a bug report for the disappearing geo build issue: 1214103
     
    Last edited: Jan 23, 2020
    kaarrrllll likes this.
  23. AverageWizard

    AverageWizard

    Joined:
    Mar 11, 2019
    Posts:
    7
    This is still an issue with the Unity 2019.4.5 LTS build and ProBuilder 4.2.3. This bug is pretty annoying and it's disappointing it hasn't been fixed after years.
     
  24. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,057
    What do you mean "still" an issue? You've listed an older version of ProBuilder. Version 4.2.3 is still the latest "verified" version of PB, but as Karl mentioned above, this is fixed in PB 4.3. So you'll need to update ProBuilder if you want the fix for this.
     
  25. AverageWizard

    AverageWizard

    Joined:
    Mar 11, 2019
    Posts:
    7
    4.2.3 is the latest version provided in Unity's official package manager.
     
  26. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,057
    You need to enable Preview packages. There are several newer versions than 4.2.3 in the package manager.
     
  27. AverageWizard

    AverageWizard

    Joined:
    Mar 11, 2019
    Posts:
    7
    upload_2020-7-28_21-42-8.png

    upload_2020-7-28_21-42-17.png

    I have preview packages enabled, 4.2.3 is still the latest version I can grab in the 2019 LTS. My complaint is that such a common, editor-breaking bug should be fixed in an LTS version.
     
  28. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,057
    I'm on 2019.4.5 LTS. Just click see all versions:

    upload_2020-7-29_10-7-49.png

    It is fixed in an LTS version.
     
  29. Jointy87

    Jointy87

    Joined:
    Dec 19, 2019
    Posts:
    19
    Hi all.

    I'm currently on Unity 2020.1.9f1 Personal and using Probuilder 4.4.0. I'm still having the problem described in this thread, namely that PB Meshes keep being shown as overrides in all my prefab instances. Looking at the known issues of this version I see the following:

    Known Issues
    • Prefab Stage does not work properly when ProBuilderMesh contains overrides that append geometry.
    Is there an ETA on when this will be fixed? Thanks in advance!
     
  30. afshin_a_1

    afshin_a_1

    Joined:
    Apr 26, 2015
    Posts:
    43
    after 4 years we still have this issue on unity 2021.3.11 using Probuilder latest version 5.0.6.
    as others mentioned above, prefabs always thinking PB objects have overrides. It's making it hard to maintain prefabs and whether they're up to date. making it hard to find actual overrides if we use some proBuilder objs in our prefab.
    This is annoying and has hindered the speed of our work.

    @kaarrrllll
    @gabrielw_unity
     
    io-games likes this.
  31. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    957