Search Unity

(ProBuilder 4.0.3) - Do Not Have "Apply Offset" Button

Discussion in 'World Building' started by Sola99, Mar 20, 2019.

  1. Sola99

    Sola99

    Joined:
    Mar 16, 2019
    Posts:
    1
    Hello! New here. I have looked everywhere for information about this but couldn't find anything, so I decided to make a forum post.

    I am following an online tutorial (posted by the Unity YouTube channel) titled "ProBuilder Building Structures with Interior and Exterior" (dated Mar 6, 2018). One of the very important tools that he uses in the creation of his house is called "Apply Offset", which allows him to make very precise shapes.

    I have tried to work around not having this tool, but the object sizes are never exact, even as I'm using ProGrids (ver. 3.0.3) with a .25 snap. For example, for the object I am creating, he is able to get it to an exact [X = 20.5, Y = 0.25, Z = 20.5] - while mine looks like [X = 20.5, Y = 0.2500997, Z = 20.50001]. These very slight offsets makes the roof that I am building impossible to make fit atop the walls.

    I have provided screenshots to compare his inspector to my own. (His has dark theme and doesn't show everything as it's cut off by the hierarchy.)

    Things I have tried already have been Googling for 2 days, digging extensively through the ProBuilder options and preferences, and making sure my ProBuilder options are exactly as his own.

    As it currently stands, I am unable to create objects with perfect dimensions - or at least this L-shaped one. I would greatly appreciate some help as this "Apply Offset" feature seems incredibly useful (or a feature similar to it so that you can create objects of any size, similar to when you create a new shape and can define its dimensions).

    Extra note: My Unity version is "2018.3.8f1" (If that's even a version - I don't understand version numbers.)

    Thank you if you read this far.
     

    Attached Files:

  2. caiqueassis

    caiqueassis

    Joined:
    Oct 13, 2018
    Posts:
    8
    I'm having the exact same problem - the "Quick Offset" and "Apply Offset" options were available to me before, but in Probuilder version 4.0.4, it doesn't show up anymore. Have you been able to solve this problem? I'm also clueless.
     
  3. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hi! Sorry about that, looks like it was lost in the update - will look into bring that back, thanks for the note!
     
  4. caiqueassis

    caiqueassis

    Joined:
    Oct 13, 2018
    Posts:
    8
    So, it has been some time, and ProBuilder is now at version 4.0.5...but the buttons are still missing :/
     
  5. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
    I'll add this to the package in an update, but in the meantime here is a menu action that you can add to your project.

    To use, create a new C# script in a folder named "Editor", then paste in the contents. You should now have a "Move Elements" action in your toolbar (if you're using the "Text" version of the toolbar).

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.ProBuilder;
    3.  
    4. namespace UnityEditor.ProBuilder.Actions
    5. {
    6.     [ProBuilderMenuAction]
    7.     sealed class MoveElements : MenuAction
    8.     {
    9.         enum CoordinateSpace
    10.         {
    11.             Local,
    12.             World
    13.         }
    14.  
    15.         static readonly TooltipContent s_TooltipFace = new TooltipContent ( "Move Faces", "Move the selected elements by a set amount." );
    16.         static readonly TooltipContent s_TooltipEdge = new TooltipContent ( "Move Edges", "Move the selected elements by a set amount." );
    17.         static readonly TooltipContent s_TooltipVert = new TooltipContent ( "Move Vertices", "Move the selected elements by a set amount." );
    18.  
    19.         static Pref<Vector3> s_MoveDistance = new Pref<Vector3>("MoveElements.s_MoveDistance", Vector3.up);
    20.         static Pref<CoordinateSpace> s_CoordinateSpace = new Pref<CoordinateSpace>("MoveElements.s_CoordinateSpace", CoordinateSpace.World);
    21.  
    22.         public override ToolbarGroup group { get { return ToolbarGroup.Geometry; } }
    23.         public override Texture2D icon { get { return IconUtility.GetIcon(null, IconSkin.Pro); } }
    24.  
    25.         public override TooltipContent tooltip
    26.         {
    27.             get
    28.             {
    29.                 if(ProBuilderEditor.selectMode == SelectMode.Face)
    30.                     return s_TooltipFace;
    31.                 if(ProBuilderEditor.selectMode == SelectMode.Edge)
    32.                     return s_TooltipEdge;
    33.                 return s_TooltipVert;
    34.             }
    35.         }
    36.  
    37.         public override SelectMode validSelectModes
    38.         {
    39.             get { return SelectMode.Face | SelectMode.Edge | SelectMode.Vertex; }
    40.         }
    41.  
    42.         public override bool enabled
    43.         {
    44.             get { return base.enabled && MeshSelection.selectedVertexCount > 0; }
    45.         }
    46.  
    47.         protected override MenuActionState optionsMenuState
    48.         {
    49.             get { return MenuActionState.VisibleAndEnabled; }
    50.         }
    51.  
    52.         protected override void OnSettingsGUI()
    53.         {
    54.             GUILayout.Label("Move Settings", EditorStyles.boldLabel);
    55.  
    56.             var dist = s_MoveDistance.value;
    57.             var coord = s_CoordinateSpace.value;
    58.  
    59.             EditorGUI.BeginChangeCheck();
    60.  
    61.             coord = (CoordinateSpace) EditorGUILayout.EnumPopup("Space", coord);
    62.             dist = EditorGUILayout.Vector3Field("Move", dist);
    63.  
    64.             if (EditorGUI.EndChangeCheck())
    65.             {
    66.                 s_MoveDistance.SetValue(dist, true);
    67.                 s_CoordinateSpace.SetValue(coord);
    68.             }
    69.  
    70.             GUILayout.FlexibleSpace();
    71.  
    72.             if (GUILayout.Button("Move Selection"))
    73.                 EditorUtility.ShowNotification(DoAction().notification);
    74.         }
    75.  
    76.         public override ActionResult DoAction()
    77.         {
    78.             if (MeshSelection.selectedObjectCount < 1)
    79.                 return ActionResult.NoSelection;
    80.  
    81.             UndoUtility.RecordSelection("Move Elements(s)");
    82.  
    83.             foreach (var mesh in MeshSelection.topInternal)
    84.             {
    85.                 var positions = mesh.positionsInternal;
    86.  
    87.                 var offset = s_CoordinateSpace.value == CoordinateSpace.World
    88.                     ? mesh.transform.InverseTransformDirection(s_MoveDistance.value)
    89.                     : s_MoveDistance.value;
    90.  
    91.                 foreach (var i in mesh.selectedCoincidentVertices)
    92.                     positions[i] += offset;
    93.  
    94.                 mesh.Rebuild();
    95.                 mesh.Optimize();
    96.                 ProBuilderEditor.Refresh();
    97.             }
    98.  
    99.             return new ActionResult(ActionResult.Status.Success, "Move " + MeshSelection.selectedVertexCount + " Element(s)");
    100.         }
    101.     }
    102. }
    103.  
     
  6. Ukon1990

    Ukon1990

    Joined:
    Apr 19, 2015
    Posts:
    1
    Is there any update on this? Having to manually add a script, to get a feature that you used to have feels bad.

    This is something that should be here. it should not take a half year to resolve this. I assume that it has been gone at least since v 4.0.3.
     
  7. caiqueassis

    caiqueassis

    Joined:
    Oct 13, 2018
    Posts:
    8
    Indeed. It is EXTREMELY frustrating, to be honest...
     
    Ukon1990 likes this.
  8. CristinaAtzberger

    CristinaAtzberger

    Joined:
    Jan 9, 2020
    Posts:
    3
    Trying that script with the latest package and getting all sorts of compiler errors like 'Assets\Editor\MoveElementsAction.cs(9,33): error CS0246: The type or namespace name 'MenuAction' even though it's using the right namespace.
     
  9. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
    This was added in ProBuilder 4.2.1, which is available through package manager.
     
  10. CristinaAtzberger

    CristinaAtzberger

    Joined:
    Jan 9, 2020
    Posts:
    3
    Yep, it turns out Unity 2019.2.6f1 didn't install ProBuilder 4.2.1 by default choosing 4.0.5 instead. Updated it and now the Offset Vertices command is there.

    Thank you!
     
    kaarrrllll likes this.
  11. svancara

    svancara

    Joined:
    May 20, 2020
    Posts:
    1
    I still dont have it there.
     
  12. Lelefant

    Lelefant

    Joined:
    Jul 1, 2015
    Posts:
    22
    I can't find the Apply Offset button in ProBuilder 4.3.1 either, which seems to be the newest version available in the Unity 2020.1.0f1 release.
    upload_2020-7-30_19-8-0.png
     
  13. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
    In the later versions this was moved to the ProBuilder toolbar as an action.