DraggableButtonInSceneView
Introduced in 1.3


Creates a Button that can be dragged. On clicked, it opens a menu with different options that will help you do more in less time with FPS Engine
How to disable
Disabling DraggableButtonInSceneView is very simple,
Go to the top toolbar and Click on Cowsins/FPS Engine Start Up
Click on "Show Draggable Button in Scene View" to turn it off.

How to add Custom Buttons to the Draggable Menu?
In ExternalButtonRegister.cs you can find all the template code you need.
Take a look at the following code:
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
namespace cowsins
{
[InitializeOnLoad]
public static class ExternalButtonRegister
{
static ExternalButtonRegister()
{
DraggableButtonInSceneView.OnAddExternalButtons += AddCustomButtons;
}
private static void AddCustomButtons(Rect menuRect)
{
float itemWidth = menuRect.width / 3;
float itemHeight = menuRect.height;
/// OVERRIDE BUTTON COUNT ( NECESSARY )
DraggableButtonInSceneView.buttonCount = 5;
/// ADD 5TH BUTTON
Texture2D customButtonImage = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/CustomButton.png");
// Add custom button
if (GUI.Button(new Rect(DraggableButtonInSceneView.GetButtonPosition(menuRect, 4), menuRect.y, itemWidth, itemHeight), customButtonImage))
{
Debug.Log("Custom Button Clicked");
}
}
}
}
#endif
/// OVERRIDE BUTTON COUNT ( NECESSARY ) DraggableButtonInSceneView.buttonCount = 5;
As you can see, the button Count is set to 5. The original button count for the Draggable Menu is 4, since there are 4 buttons. As we are adding a new button, we must update the button count to 5.
/// ADD 5TH BUTTON Texture2D customButtonImage = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/CustomButton.png"); // Add custom button if (GUI.Button(new Rect(DraggableButtonInSceneView.GetButtonPosition(menuRect, 5), menuRect.y, itemWidth, itemHeight), customButtonImage)) { Debug.Log("Custom Button Clicked"); }
This is the code necessary to add a new Button.
First we gather the Texture or Image we want to display on the button. Change "Assets/CustomButton.png" with your own path.
Inside the creation of the Rect, make sure 5 corresponds to the current button index being added, in this case, it is correct, as we are making a 5th button. GetButtonPosition(menuRect, 5) Inside the if statement, you can add all the code you need to perform on clicking the button. Right now, it only displays a message.
Debug.Log("Custom Button Clicked");
Last updated