Search Unity

ProBuilder 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:
    18
    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:
    18
    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:
    161
    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:
    18
    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:
    628
    Hi Chris, can you double-check in 4.0.5? Thanks!
     
  6. chris_gamedev

    chris_gamedev

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

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    628
    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:
    18
    That absolutely works, thanks!
     
    unity_ZQuXzhcJlZ4Qiw likes this.
  11. happyrobotstudio

    happyrobotstudio

    Joined:
    Apr 13, 2019
    Posts:
    12
  12. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    161
    This is fixed as of 4.1.0 (which is available through Package Manager).