Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

pb_Object.CenterPivot missing

Discussion in 'World Building' started by jj_unity328, Jun 25, 2018.

  1. jj_unity328

    jj_unity328

    Joined:
    Jun 7, 2018
    Posts:
    22
  2. jj_unity328

    jj_unity328

    Joined:
    Jun 7, 2018
    Posts:
    22
  3. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
    It depends on what version of ProBuilder you're using, but off the top of my head I think it's an extension defined in the ProBuilder2.MeshOperations namespace.
     
  4. jj_unity328

    jj_unity328

    Joined:
    Jun 7, 2018
    Posts:
    22
    Aaah, we're getting somewhere!

    But now I'm getting this error:
    pb_MeshOps.CenterPivot(pb_Object, int[])' is inaccessible due to its protection level

    I'm not sure why but it might explain why Quick-Actions didn't find it in the first place.

    I went to see the definition and this is what I got. Is it because it's marked as `internal` instead of `public`?

    Code (CSharp):
    1. namespace ProBuilder.MeshOperations
    2. {
    3.     internal static class pb_MeshOps
    4.     {
    5.         public static bool Bridge(this pb_Object pb, pb_Edge a, pb_Edge b, bool enforcePerimiterEdgesOnly = false);
    6.         public static void CenterPivot(this pb_Object pb, int[] indices);
    7.         public static void CenterPivot(this pb_Object pb, Vector3 worldPosition);
    8.         // ...
    9.      }
    10. }
     
  5. jj_unity328

    jj_unity328

    Joined:
    Jun 7, 2018
    Posts:
    22
    Right now, as the pivot sadly also get resetted when spawning a prefab. The only trick around the issue is to nest it in a parent and decenter it so I can rotate my prefab on its center.
     
  6. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
    Yeah, it looks like it's private currently. The 4.0.0 update introduces public API for most of ProBuilder, this included. Should be out soon.
     
    jj_unity328 likes this.