Jump to content
Sign in to follow this  
Matt1988

Dimensions Overlay activate on Launch ProBuilder 2 and Probuilder 3

Recommended Posts

Someone mentioned that they would like Dimensions Overlay to be enabled by default when Unity starts. put the below code into a CSharp script and put the script in a folder called "Editor".

This code is for ProBuilder 2 and won't work with ProBuilder 3.0.1 which is available in the Packages Manager in the Unity 2018 Beta. I'm currently working out how to make this work in ProBuilder 3.

using UnityEditor;
using ProBuilder2.EditorCommon;

[InitializeOnLoad]
public class StickyDimensionsOverlay {

	static StickyDimensionsOverlay()
    {
        pb_DimensionsOverlay.Init();
    }
}

Edit: Upon further inspection, it appears that ProBuilder 3.0.1 does not have the Dimensions Overlay as part of the public API.. Or it's hidden really, really well..

Edit: Upon even further inspection, it turns out that you can call Menu Items programatically, However Menu Items get compiled after IntializeOnLoad classes, so you have to do some more magic.

 

For Probuilder 3

This one will Activate the Dimension Overlay every time you select a new object. A temporary work around until Dimensions Overlay classes are exposed in Pb3

using UnityEditor;
[InitializeOnLoad]
public class StickyDimensionsOverlay
{
    static StickyDimensionsOverlay()
    {
        Selection.selectionChanged += OnSelectionChanged;
    }

    static void OnSelectionChanged()
    {
        EditorApplication.ExecuteMenuItem("Tools/ProBuilder/Dimensions Overlay/Show");
    }
}

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×