Search Unity

Question ProBuilder runtime API object creation and face picking

Discussion in 'World Building' started by Chrueschsch1e, Apr 29, 2022.

  1. Chrueschsch1e

    Chrueschsch1e

    Joined:
    Jan 28, 2020
    Posts:
    16
    Hello!
    We are experiencing strange behavior from the ProBuilder runtime API.

    If we, for example, create a ProBuilder object, say a cylinder (other object show same behavior), with
    Code (CSharp):
    1. ShapeGenerator.CreateShape(ShapeType.Cylinder)
    the resulting object has different components attached, depending on if we debug it in the Unity editor play mode or in the (Windows) build.

    By hitting a breakpoint after creation and inspecting the created object, we can see that in the editor play mode the object has a "ProBuilder MeshFilter" and a "Pb_Mesh (Mesh Filter) [sic]" component attached.
    EditorComponents.png
    In the build however the object created by the same code merely has a "ProBuilderMesh" and a normal "MeshFilter" attached. It is also drawn bright pink, as if the material was missing (which cannot be the case).
    BuildComponents.png
    How can this difference be explained? Naturally we are using the same version of ProBuilder in both cases (5.0.4).

    This difference seems to have an influence on the ProBuilder face picking:
    In the editor play mode, by calling
    Code (CSharp):
    1. SelectionPicker.PickFacesInRect(...)
    we can get the faces of the object just fine (see documentation here).
    In the build however, the object is never found. The resulting list of faces is empty, which is a big problem for us.

    We replicated this behavior in a fresh 3D URP Template project in Unity version 2021.1.24, as we develop in this version.
    To top the whole thing of: trying the same code in a clean 3D URP Template project in version 2021.3.1 LTS, we experience that the object components behave exactly the same as described above, but that we cannot pick any faces at all - no matter if build or editor play mode.

    Are we missing something here?
    Any help is greatly appreciated.

    Thanks and greetings,
    Christian
     
  2. Chrueschsch1e

    Chrueschsch1e

    Joined:
    Jan 28, 2020
    Posts:
    16
    The problem still persists.
    We opened a bug report in the meantime (case 1425844).