Search Unity

ProBuilderize doesn't retain materials as expected

Discussion in 'World Building' started by chris_gamedev, May 16, 2019.

  1. chris_gamedev

    chris_gamedev

    Joined:
    Feb 10, 2018
    Posts:
    34
    Hey guys,

    I'm currently prototyping a level using some meshes I exported from another project which was originally in OBJ format and was exported with the original materials attached. The geometry is fairly simple, but I have reason to manipulate the meshes fairly frequently in the prototyping and the easiest way to do that is just to ProBuilderize the object and extend the meshes with ProBuilder.

    Perhaps a fairly niche use case, I'm not sure, but ProBuilderize (in the latest ProBuilder version in the Package Manager) isn't quite working how I'd hope.

    Here's an object I want to ProBuilderize:

    upload_2019-5-16_23-31-6.png

    And the properties in the Inspector which show the different materials:

    upload_2019-5-16_23-31-48.png

    Hopefully nothing too unusual here (though I'm new so I don't understand everything).

    And this is what it looks like after I ProBuilderize:

    upload_2019-5-16_23-34-1.png

    Once it is ProBuilderize, the Inspector doesn't change much. Which feels kind of odd because the materials which are no longer applied to the faces, are still present:

    upload_2019-5-16_23-38-11.png

    It's not insurmountable. I have to reapply the materials to the correct faces, though I'm sure you can appreciate that's fairly tedious.

    Does anyone know why this is happening? Is it a bug? Am I doing something wrong?

    Any advice is greatly appreciated :)

    Chris
     
  2. chris_gamedev

    chris_gamedev

    Joined:
    Feb 10, 2018
    Posts:
    34
    I've done a bit of testing. The two most relevant versions to this issue are ProBuilder 3.0.9 where it last worked, and ProBuilder 4.0.2 which is the first version I can access via the Package Manager where it doesn't work.

    So the issue could have been introduced in 4.0.0, 4.0.1, or 4.0.2.

    If there is a more appropriate place to report a bug, let me know, thanks :)
     
  3. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
    The best place to submit bug reports is through the Editor, under "Help > Report a bug...". If you can attach the OBJ and materials that are causing trouble that would be a big help :)
     
    chris_gamedev likes this.
  4. chris_gamedev

    chris_gamedev

    Joined:
    Feb 10, 2018
    Posts:
    34
    Thanks Karl.

    I've just submitted the bug report now with a sample project and the source model and materials. Very easily reproducible, hopefully it's something that can be fixed and not something wrong with the source model.
     
    kaarrrllll likes this.
  5. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hi Chris, can you double-check in 4.0.5? Thanks!
     
  6. chris_gamedev

    chris_gamedev

    Joined:
    Feb 10, 2018
    Posts:
    34
    Already using 4.0.5 and same problem unfortunately.
     
  7. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Ok! Can you link me to the fogbugz? Thanks!
     
    chris_gamedev likes this.
  8. monblank

    monblank

    Joined:
    Nov 3, 2018
    Posts:
    3
    I have the same issue. Probuilderize mesh with multiple materials works correctly only in 3.0.9, further up to version 4.0.5 the problem is reproduced.
     
    chris_gamedev likes this.
  9. unity_ZQuXzhcJlZ4Qiw

    unity_ZQuXzhcJlZ4Qiw

    Joined:
    Aug 28, 2018
    Posts:
    1
    Hi all.
    As quick and dirty hack, you can modify one line in ProBuilder package.
    In Submesh.cs change line 200
    from:
    var index = Array.IndexOf(materials, face.material);

    to:
    var index = face.submeshIndex;


    face.materials is deprecated, looks like it was just accidentally forgotten in Submesh.cs.
    Works for me on Probuilder 4.0.5
    To make this fix permanent, you can move Probuilder package to Packages folder for some time, and wait for new version to fix it.
     
    Last edited: Jun 5, 2019
    alexandyr, monblank and chris_gamedev like this.
  10. chris_gamedev

    chris_gamedev

    Joined:
    Feb 10, 2018
    Posts:
    34
    That absolutely works, thanks!
     
    unity_ZQuXzhcJlZ4Qiw likes this.
  11. happyrobotstudio

    happyrobotstudio

    Joined:
    Apr 13, 2019
    Posts:
    14
    Works great, thanks
     
  12. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
    This is fixed as of 4.1.0 (which is available through Package Manager).
     
  13. Czar-Man

    Czar-Man

    Joined:
    May 10, 2013
    Posts:
    20
    I exported my probuilder mesh from a previous project as an obj. I haven't been able at all to use Polybrush even with this version.

    I'm at the point where I'd rather work on it in Maya instead.

    EDIT: After uninstalling the Asset store versions and importing from the package manager, then using either Tools>Polybrush>Bake Vertex Streams or Update_Z_AdditionalVertexStreams, I can now, almost consistently use texture fills.

    My only issues now are that I can't view many of the textures from certain angles or distances. Some planes also won't let me fill them for some reason.
     
    Last edited: Oct 12, 2019
  14. Duong216

    Duong216

    Joined:
    Nov 21, 2021
    Posts:
    3

    I can't believe that in 2022, this still works for me. Thanks bro!