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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Problem with disappearing probuilder meshes.

Discussion in 'World Building' started by Freenzer, Oct 10, 2019.

  1. Freenzer

    Freenzer

    Joined:
    Jun 29, 2018
    Posts:
    2
    Hi,
    Recently I have weird problem with disappearing meshes created in Probuiler 4.1.0

    Couple of days ago I've created platforms using probuilder - everything was fine, I could edit them, duplicate them and so on. Right now, for the first glance everything is fine, I can move them in space, but I can't edit them with probuilder and as soon as I use Undo, Duplicate or use any other action, the mesh vanish.

    Have any of you got the same problem? Maybe know the solve for that....
    Thanks for helping in advance!


    Unity ver. 2018.3.12f1
     
  2. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    548
    Is ProBuilder still in your project, and do the mesh GameObjects still have a reference to the ProBuilderMesh component?
     
  3. Freenzer

    Freenzer

    Joined:
    Jun 29, 2018
    Posts:
    2
    Thanks for respond.
    Unfortunately ProBuilder is in my project and I believe there's still reference to the PB mesh.
     

    Attached Files:

    • 22.png
      22.png
      File size:
      50.8 KB
      Views:
      701
    • 222.png
      222.png
      File size:
      55.5 KB
      Views:
      679
  4. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    548
    That's strange, it shows the bounds as 0,0,0. If your MeshFilter mesh is still valid, then this script will be able to recover the mesh information. To use it, create a new folder in your project named "Editor", then create a script with these contents. After, run the menu item "Tools > ProBuilder > Repair >
    Rebuild Empty ProBuilderMesh Components" in each scene with broken meshes.

    Code (CSharp):
    1. using System;
    2. using System.Text;
    3. using UnityEditor;
    4. using UnityEngine;
    5. using UnityEngine.ProBuilder;
    6. using UnityEditor.ProBuilder;
    7. using UnityEngine.ProBuilder.MeshOperations;
    8. using UObject = UnityEngine.Object;
    9.  
    10. static class RepairEmptyComponent
    11. {
    12.     /// <summary>
    13.     /// Menu interface for manually re-generating all ProBuilder geometry in scene.
    14.     /// </summary>
    15.     [MenuItem("Tools/ProBuilder/Repair/Rebuild Empty ProBuilderMesh Components", false)]
    16.     public static void MenuForceSceneRefresh()
    17.     {
    18.         StringBuilder sb = new StringBuilder();
    19.         ProBuilderMesh[] all = UObject.FindObjectsOfType<ProBuilderMesh>();
    20.  
    21.         for (int i = 0, l = all.Length; i < l; i++)
    22.         {
    23.             UnityEditor.EditorUtility.DisplayProgressBar(
    24.                 "Rebuild ProBuilder Objects",
    25.                 "Rebuilding ProBuilderMesh " + all[i].name + ".",
    26.                 ((float)i / all.Length));
    27.  
    28.             var mf = all[i].GetComponent<MeshFilter>();
    29.             var sm = mf == null ? null : mf.sharedMesh;
    30.  
    31.             try
    32.             {
    33.                 // If the ProBuilderMesh component data was lost somewhere, don't ToMesh() and nuke the existing (good)
    34.                 // mesh filter. Instead try rebuilding from the sharedmesh data.
    35.                 if (sm != null && sm.vertexCount > 0 && all[i].vertexCount < 1)
    36.                 {
    37.                     var mesh = all[i];
    38.                     var source = mesh.GetComponent<MeshFilter>().sharedMesh;
    39.                     var materials = mesh.GetComponent<MeshRenderer>().sharedMaterials;
    40.                     MeshImporter importer = new MeshImporter(mesh);
    41.                     importer.Import(source, materials, new MeshImportSettings() { quads = true, smoothing = true, smoothingAngle = 1f });
    42.                     mesh.ToMesh();
    43.                     mesh.Refresh();
    44.                     mesh.Optimize();
    45.                 }
    46.             }
    47.             catch (Exception e)
    48.             {
    49.                 sb.AppendLine("Failed rebuilding: " + all[i] + "\n\t" + e);
    50.             }
    51.         }
    52.  
    53.         if (sb.Length > 0)
    54.             Debug.LogError(sb.ToString());
    55.  
    56.         UnityEditor.EditorUtility.ClearProgressBar();
    57.         UnityEditor.EditorUtility.DisplayDialog("Refresh ProBuilder Objects",
    58.             "Successfully refreshed all ProBuilder objects in scene.",
    59.             "Okay");
    60.     }
    61. }
    62.  
     
  5. salehi-gamedesign

    salehi-gamedesign

    Joined:
    Apr 30, 2018
    Posts:
    15
    I'm having a similar problem. I have used ProBuilder extensively in my project to create prefab objects and am being plagued with an issue where meshes will disappear from prefab instances within the scene when I play the game within Unity.

    ***Note that not all of the prefab instances within the scene which were built using ProBuilder lose their meshes, i.e. if I place two identical pillar prefab instances in my scene, one might lose its mesh.***

    I have not been able to identify what is causing this behaviour after investigating it for days - the ProBuilder objects which lose their collider meshes appears to be completely random.

    I'm using Unity 2019.3 and ProBuilder 4.3.0 preview 2.

    Any help would be appreciated.
     
  6. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    548
    Try updating to the latest preview, there have been some fixes that may address your issues.
     
  7. salehi-gamedesign

    salehi-gamedesign

    Joined:
    Apr 30, 2018
    Posts:
    15
    Hi kaarrrllll, thanks for the reply. I'll try that and report back here.
     
  8. salehi-gamedesign

    salehi-gamedesign

    Joined:
    Apr 30, 2018
    Posts:
    15
    That seems to have fixed the issue, many thanks.
     
    kaarrrllll likes this.
  9. damiann5f

    damiann5f

    Joined:
    Apr 10, 2017
    Posts:
    2
    Hi,

    I have the same issue as fellow members. I am working using ProBuilder 4.2.3 and Unity 2019.3.10f1.
    I tried updating to preview.4 and preview.7 4.3.0 but both cause all meshes to disappear with is even worst.
    I tried 'Rebuild Empty ProBuilderMesh Components' - did not help.

    Any suggestions?
     
  10. HouseFrog

    HouseFrog

    Joined:
    Jan 14, 2016
    Posts:
    31
    My meshes vanish when moving the gameobject position by code.
    Do I need to uninstall probuilder to use the preview-version, or can I have both installed?
     
  11. Yalroc_Studios

    Yalroc_Studios

    Joined:
    Apr 7, 2018
    Posts:
    4
    Same for me and and 'Rebuild Empty ProBuilderMesh Components' - did not help.

    Lost everyhting ?? :(
     
  12. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    548
    You can only have one version of ProBuilder installed, and it should be from the Package Manager (not the Asset Store).

    That shouldn't be a problem, can you post your code?

    Were you working with a preview version as well?
     
  13. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,866
    @kaarrrllll I'm a little confused about where exactly is ProBuilder storing the shared meshes once you "ProBuilderize" them.
    I have searched the docs but it doesn't specify it.
    I'm concerned of my meshes vanishing. I can export them, but then they are not editable anymore.
    I have noticed that creating a prefab with a ProBuilderized mesh creates a new (different name) mesh at each instance.
    So, how is ProBuilder really handling the meshes it generates?
    Does it store the meshes in the scene like when you create a new mesh via script? Does it store them on a temp folder? Are the meshes stored inside the ProBuilder component in the gameobject? But how?
    Thanks :)
     
  14. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    548
    Meshes are stored in the scene as part of the `ProBuilderMesh` component.
     
  15. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,866
    So, just like any other New Mesh() you can generate on a regular script?
     
  16. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    548
    Not exactly, the ProBuilderMesh component is what contains the editable mesh data. It then compiles that to a UnityEngine.Mesh that is generated as-necessary.
     
    atomicjoe likes this.
  17. Air_In

    Air_In

    Joined:
    Jun 5, 2020
    Posts:
    2
    Hello Kaarrrllll! I used your script with ProBuilder, however my meshes from my objects will not come back. upload_2020-12-30_16-7-54.png
     
  18. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,866
    Nice flamingos.
     
  19. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    548
    I don't see a ProBuilderMesh component on the selected object. Did you export the meshes, or otherwise remove the ProBuilder components?
     
  20. ttank7

    ttank7

    Joined:
    Apr 18, 2011
    Posts:
    42
    Hello,

    I recently went to install probuilder again in the package manager. I had it installed previously, and am unsure how it got removed over the past few months. I believe it might have removed itself upon the unity update I did last month, but am unsure (as I used it extensively this past summer, but then went on to do other things, and came back and realized its no longer in packages folder). Oddly enough, even with probuilder not installed, all my probuilder objects in my scenes showed up correctly.

    Now that I re-installed probuilder. I am having the same problem as the OP. Using Unity 2020.2.0f1. Using Probuilder 4.4.0. Installed via package manager. I tried all the latest versions (pro builder 5), and even went back a few versions, still no meshes appearing.

    If I remove probuilder from the packagmanager after installing it, and re-open the same level, then the meshes re-appear again. But the second I install it again, they disappear again.

    All of my meshes are now invisible and their Object Sizer (read only) are all set to 0,0,0. I still have the Probuildermeshfilter component, and there is a mesh there.

    I tried to use the script above, but it gives this error after creating it:

    "Assets\Editor\NewBehaviourScript.cs(44,30): error CS1501: No overload for method 'Import' takes 3 arguments"

    Any ideas on why the script gives an error, and how to get back all my Probuilder models back?
     
  21. ttank7

    ttank7

    Joined:
    Apr 18, 2011
    Posts:
    42
    I also noticed that in the scene file that was open when I did the probuilder install, it still shows the mesh in the Probuildermeshfilter component. However, in another scene I have with probuilder objects (this scene was not open up installing probuilder), the mesh is missing in both the collider and the Probuildermeshfilter components? It throws this error:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.ProBuilder.SharedVertex.GetSharedVertexLookup (System.Collections.Generic.IList`1[T] sharedVertices, System.Collections.Generic.Dictionary`2[TKey,TValue] lookup) (at Library/PackageCache/com.unity.probuilder@4.4.0/Runtime/Core/SharedVertex.cs:146)
    UnityEngine.ProBuilder.ProBuilderMesh.get_sharedVertexLookup () (at Library/PackageCache/com.unity.probuilder@4.4.0/Runtime/Core/ProBuilderMesh.cs:324)
    UnityEngine.ProBuilder.ProBuilderMesh.CacheSelection () (at Library/PackageCache/com.unity.probuilder@4.4.0/Runtime/Core/ProBuilderMeshSelection.cs:106)
    UnityEngine.ProBuilder.ProBuilderMesh.get_selectedSharedVerticesCount () (at Library/PackageCache/com.unity.probuilder@4.4.0/Runtime/Core/ProBuilderMeshSelection.cs:64)
    UnityEditor.ProBuilder.MeshSelection.RecalculateSelectedComponentCounts () (at Library/PackageCache/com.unity.probuilder@4.4.0/Editor/EditorCore/MeshSelection.cs:273)
    UnityEditor.ProBuilder.MeshSelection.OnComponentSelectionChanged () (at Library/PackageCache/com.unity.probuilder@4.4.0/Editor/EditorCore/MeshSelection.cs:223)
    UnityEditor.ProBuilder.MeshSelection.OnObjectSelectionChanged () (at Library/PackageCache/com.unity.probuilder@4.4.0/Editor/EditorCore/MeshSelection.cs:197)
    UnityEditor.Selection.Internal_CallSelectionChanged () (at <fac3a832ec4249a49c4da1051848dde5>:0)

    I will also need to know how to retrieve my probuilder data from this other scene as well, thanks.
     
  22. ttank7

    ttank7

    Joined:
    Apr 18, 2011
    Posts:
    42
    We were able to get a working scene file again by reverting the scene on GIT. We are not sure why this happened, but we believe it had to do with me using a newer version of ProBuilder (4.4.0), then pushing it on GIT, and my friend then opened the level in an older version of ProBuilder (4.3.1), and then saved the level, and pushed it. Afterwards I re-opened it with the newer version ProBuilder (4.4.0), and saved it. This worked fine.

    But then somehow, my ProBuilder (4.4.0) got deleted in the packages folder, not sure how we think upon the Unity upgrade (2020.2.0f1). During this time (with no Probuilder installed) I continued to save the scene file, the models were visible this entire time even though I had no Probuilder installed.

    Fast forward to this week, I needed to make new levels, realize I no longer had Probuilder installed, and after installing Probuilder (4.4.0) again, the meshes were missing in the scene file. Removing Probuilder made the meshes re-appear. Installing it again made them disappear. Very odd behavior.

    So in order to fix, we reverted the scene file back to before when my co-worker opened/saved it, and now it works when the newest Probuilder is installed again.

    Here is a small part of the GIT Diff file for the scene in the particular commit that caused the issues (my friend never edited any of the PB meshes, so not sure why there is tons of additions and deletions of PB_mesh data):

    --- a/Levels/Poly World/Levels/Capsule Kingdom/Capsule_Kingdom.unity
    +++ b/Levels/Poly World/Levels/Capsule Kingdom/Capsule_Kingdom.unity
    @@ -342,7 +342,7 @@ Mesh:
    m_CorrespondingSourceObject: {fileID: 0}
    m_PrefabInstance: {fileID: 0}
    m_PrefabAsset: {fileID: 0}
    - m_Name: pb_Mesh82838
    + m_Name: pb_Mesh45652
    serializedVersion: 10
    m_SubMeshes:
    - serializedVersion: 2
    @@ -1734,7 +1734,7 @@ Mesh:
    m_CorrespondingSourceObject: {fileID: 0}
    m_PrefabInstance: {fileID: 0}
    m_PrefabAsset: {fileID: 0}
    - m_Name: pb_Mesh82140
    + m_Name: pb_Mesh44952
    serializedVersion: 10
    m_SubMeshes:
    - serializedVersion: 2
    @@ -2652,8 +2652,6 @@ MonoBehaviour:
    Order: 2
    Spawnpoints:
    - {fileID: 2100922781}
    - - {fileID: 0}
    - - {fileID: 0}
    --- !u!135 &69194261
    SphereCollider:
    m_ObjectHideFlags: 0
    @@ -2744,8 +2742,8 @@ GameObject:
    - component: {fileID: 72832131}
    - component: {fileID: 72832135}
    - component: {fileID: 72832134}
    - - component: {fileID: 72832133}
    - component: {fileID: 72832132}
    + - component: {fileID: 72832133}
    m_Layer: 0
    m_Name: Checkpoint 1
    m_TagString: Untagged
    @@ -2761,7 +2759,7 @@ Transform:
    m_PrefabAsset: {fileID: 0}
    m_GameObject: {fileID: 72832130}
    m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
    - m_LocalPosition: {x: -87.17, y: -50.45, z: 37.22}
    + m_LocalPosition: {x: -87.09, y: -50.45, z: 42.17}
    m_LocalScale: {x: 15, y: 15, z: 15}
    m_Children:
    - {fileID: 1344764288}
    @@ -2785,9 +2783,8 @@ MonoBehaviour:
    Spawnpoints:
    - {fileID: 1344764288}
    - {fileID: 1093758639}
    - - {fileID: 0}
    ---- !u!135 &72832133
    -SphereCollider:
    +--- !u!65 &72832133
    +BoxCollider:
    m_ObjectHideFlags: 0
    m_CorrespondingSourceObject: {fileID: 0}
    m_PrefabInstance: {fileID: 0}
    @@ -2797,8 +2794,8 @@ SphereCollider:
    m_IsTrigger: 1
    m_Enabled: 1
    serializedVersion: 2
    - m_Radius: 1.5
    - m_Center: {x: 0, y: 0, z: 0}
    + m_Size: {x: 5.2429314, y: 1.1641829, z: 1.2105497}
    + m_Center: {x: -0.37728095, y: 0.467727, z: 0.10527408}
    --- !u!23 &72832134
    MeshRenderer:
    m_ObjectHideFlags: 0
    @@ -2865,6 +2862,179 @@ MonoBehaviour:
    m_Name:
    m_EditorClassIdentifier:
    Flags: 1
    +--- !u!43 &74753402
    +Mesh:
    + m_ObjectHideFlags: 0
    + m_CorrespondingSourceObject: {fileID: 0}
    + m_PrefabInstance: {fileID: 0}
    + m_PrefabAsset: {fileID: 0}
    + m_Name: pb_Mesh46716
    + serializedVersion: 10
    + m_SubMeshes:
    + - serializedVersion: 2
    + firstByte: 0
    + indexCount: 288
    + topology: 0
    + baseVertex: 0
     
    FURKANKAHVECI and ekawano114 like this.
  23. FURKANKAHVECI

    FURKANKAHVECI

    Joined:
    May 12, 2013
    Posts:
    25
    All new versions except ProBuilder (4.2.3) broke the scene. Save scene with newer version does not work.
    -Unity 2020.3.14f1
     
  24. KaidaStudios

    KaidaStudios

    Joined:
    Aug 4, 2017
    Posts:
    34
    For anyone who stumbles across this looking for answers. I solved it by noticing that meshes that would disapeer would have a missing script on them that would be added upon installing probuilder. Removing the missing scripts in my game before importing ProBuilder allowed my meshes to no longer disapeer
     
  25. tcoliukos

    tcoliukos

    Joined:
    Mar 11, 2021
    Posts:
    4
    I'm having an issue with mesh disappearing, if anyone can point me in the right direction, it would be appreciated.

    Using Windows 10 Pro, Unity 2021.3.11f1, URP, Probuider 5.0.6, Progrids 3.0.3-preview.6

    Some details...

    I'm having issues with 2nd floor outer walls...
    - I open the project, everything looks fine, it will build and run without issues, no errors (screenshot01).
    - If I select the problem object, the mesh disappears from both MeshFilter and MeshCollider (screenshot02)
    - Also, I notice on my "good" objects, MeshFilter appears towards the top of the inspector, not at the bottom.
    - If I then Repair>RebuildAllProbuilderObjects, the MeshFilter recovers the Mesh, but the MeshCollider does not. (screenshot03)

    What is really strange is that I've actually rebuilt this object twice from scratch, having the same thing happen both times. This is the only object in the project giving me issues. While I've rebuilt this object from scratch, I've reused the windows and a molding and added them as child objects of the outer walls. This leads me to believe that there's possibly an issue with one of these child objects, although they exhibit none of this behavior themselves.

    Also, worth noting, earlier today I was having zero issues with my latest "rebuild" of this object. The problem suddenly appeared again. I thought I had the issue licked by rebuilding it.

    Also, I'm noticing that a "NewShape" tooltip is stuck on the screen now (but without the contents of the tooltip). So I'm thinking that maybe something with Probuilder itself is corrupted. Maybe I can uninstall / reinstall Probuilder from my project, while keeping my existing objects intact?

    I guess my next approach, unless someone can enlighten me, will be to rebuild again, make a backup object of it while it is still "good", in case it fails again, I won't add the child objects this time, and see what happens. Sound reasonable?

    Sorry about the wall of text. I'm somewhat of a noob, been working on this since October, been getting a little more familiar with Probuilder as time goes on, avoiding previous pitfalls and such, but this has me stumped.

    I'm going to upload a few screen shots as well.

    Anyone have any ideas?
    MeshIssuesSS01.jpg MeshIssuesSS02.jpg MeshIssuesSS03.jpg
     
  26. tcoliukos

    tcoliukos

    Joined:
    Mar 11, 2021
    Posts:
    4
    Started working on this a little bit tonight. I ended up migrating the project into a new project and that got rid of the tooltip issue, but the mesh issue wasn't resolved. I copied the Assets, Project Settings, and Packages folders over to a new "restore" folder, then opened up the project from there. At least now I can move forward.

    Looks like I better get acquainted with Blender. I've been putting it off, but now it's pretty clear to me that Probuilder is probably more hassle than it's worth.
     
  27. Curwen

    Curwen

    Joined:
    Jan 12, 2015
    Posts:
    13
    I had issues with probuilder meshes disappearing on previous versions of it when using export to FBX, but that seems to have been fixed in recent probuilder versions, so I can't contribute to that particular issue.

    On the topic of it seeming corrupted though (the tooltips), I ran into stuff like that recently after upgrading a project from Unity 2021.x to 2022.x. Unity would report some of my scripts as not found even though Visual Studio considered them part of the solution, and it would randomly loose reference to some scripts on gameobjects, showing them as missing scripts.

    If you see behaviors that seem like your project is corrupted, I'd suggest deleting your local folders, the ones that you don't commit to version control. In particular, the Library folder, but I usually also delete Logs and obj folders as well. Then when you re-open Unity, it will be forced to rebuild the library, and that should help ensure you're working with a clean one. Of course if you don't use version control, make sure you back up your project ahead of time just in case.
     
    tcoliukos likes this.
  28. tcoliukos

    tcoliukos

    Joined:
    Mar 11, 2021
    Posts:
    4
    Thanks for the input Curwen. Yeah, that's essentially what I did for the tooltip thing and all is good there. It seems that some of the child objects were definitely corrupt, causing the mesh to be lost on the parent. When I went to rebuild again, some of the windows started glitching out on me, losing the mesh on them, but they were no longer child objects of the outer walls, so they didn't affect the outer wall mesh.. I haven't done much work on it this week, but so far I haven't had any more issues. I also took some extra precautions this time to save myself from rebuilding from scratch in the future, if the problem comes up again. Hopefully, this issue is behind me.