Search Unity

Probuilder on WebGL Add BoxCollider - WebGL error "BoxCollider not Unity engine type"-can't interact

Discussion in 'World Building' started by Tarrag, Jan 12, 2020.

  1. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    166
    Hey all,

    I create a box at runtime with probuilder, when built on WebGL and opened on browser I get runtime error "AddComponent asking for "BoxCollider" which is not a Unity engine type." and no OnMouseDown is registered, so can't interact with 3D object. It works just fine on editor.

    Tested on probulider 4.2.1 and 4.3.0 prev .1 , Unity 2019.3.0f3, URP 7.1.6

    Anyone having this problem and found a solution? Bug raised here.
    Thanks a bunch for your help
     
  2. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    166
    In case it helps anyone with this prob, here's the reponse Unity team kindly sent over and solved the issue in my case cos I had a mesh only when built at runtime:

    The project has Engine code stripping enabled, which removes unused Engine code from the build. In your case, none of the scenes are using the "BoxCollider" component, so it gets stripped from the build during the code stripping phase, and thus later you encounter those errors. To fix this behavior, you can either disable code stripping in the Player Settings or create some "dummy" object which would store the needed components and prevent them from being stripped.
     
unityunity