Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    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:
    548
    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:
    548
    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.