Search Unity

ProBuilder lightweight render pipeline material error

Discussion in 'World Building' started by DebugLogError, Jun 9, 2019.

  1. DebugLogError

    DebugLogError

    Joined:
    Jul 24, 2013
    Posts:
    60
    I am trying to create a polyshape at runtime while using the lightweight render pipeline. This throws an error in probuilder when it tries to get the default material. I don't have access to the logs right now, but I can reliably reproduce it and it goes away when I disable the lightweight render pipeline.

    I am using Unity 2019.1.5f1 and ProBuilder 4.0.5.
     
  2. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hi, sorry for the wait - I'll give this a try but meanwhile could you (if not already) log a bug for this? (via Help > Report a Bug). Thanks!
     
  3. DebugLogError

    DebugLogError

    Joined:
    Jul 24, 2013
    Posts:
    60
    I cannot reproduce it in the Unity Editor, only in builds (Android, Oculus Quest).
    It's hard to pull the full logs from the device, but here's the relevant log lines:

    NullReferenceException: Object reference not set to an instance of an Object
    UnityEngine.ProBuilder.BuiltinMaterials.Init () (at)
    UnityEngine.ProBuilder.BuiltinMaterials.get_defaultMaterial ()
    UnityEngine.ProBuilder.MeshOperations.AppendElements.CreateShapeFromPolygon ()
     
  4. ShaneChristopher

    ShaneChristopher

    Joined:
    Nov 6, 2018
    Posts:
    12
    I am also seeing this when building a Polyshap, it happens in WebGL, it seems to only happen once and there isn't anything visually wrong afterwards
     
    DebugLogError likes this.
  5. Florian_Amthor

    Florian_Amthor

    Joined:
    Nov 27, 2015
    Posts:
    1
    If anyone still sees this error i found a workaround.

    When you call mesh.CreateShapeFromPolygon(...) surround it with a try catch block.

    It's dirty but it's working for the moment until that matter gets clarified.

    There is also the problem - and maybe the source - that the materials from ProBuilder package(v4.1.0 and older 4.x.x versions) won't be converted properly to be usable with the HDRP.

    Materials are found in Packages/com.unity.probuilder(ProBuilder)/Content/Resources/Materials

    upload_2019-11-1_18-30-44.png upload_2019-11-1_18-30-56.png
     
    pdinklag and DebugLogError like this.
  6. pdinklag

    pdinklag

    Joined:
    Jan 24, 2017
    Posts:
    154
    I can confirm this for builds also on Windows. It doesn't happen in the editor at all.
    Since it appears that absolutely nothing is going to happen otherwise, I filed a bug report for it and will link it here once it's been reviewed.

    For me, the mesh isn't being generated at all, so this means missing meshes in my builds. Still better than a crash, though, I guess.

    I agree it's probably connected to materials being mapped to the error shader and mentioned that in the report, too. For these kinds of "emergencies", package assets should be editable really.

    EDIT: Apparently it was reported in December and is already fixed in a preview build. Yay!
     
    Last edited: Feb 24, 2020