Custom popups matching EditorGUILayout.Popup style

So I’m just tidying up one of my editor interfaces and I wanted the button used to pop up a generic menu to match the style used by Unity for it’s drop down menus in the inspector. i.e with an up and down arrow to the right.

I’m not using EditorGUILayout.Popup because I don’t want to add a delay whenever the inspector is shown which would occur if I created the array of options in OnEnable or OnInspectorGUI. Instead I wish to populate the menu when/if the user clicks the drop down button, at which point in my example I scan the project’s path for scene files.

To use call EdDelayedPopup.Popup and pass it the string or GUIContent you wish to display in the button and a function to call when the button is pressed. When the function is called you can query EdDelayedPopup.ButtonRect to get the rectangle of the button and GenericMenu.DropDown to open a menu there or even use your own custom window.
Continue reading Custom popups matching EditorGUILayout.Popup style

How to disable touches / mouse clicks in uGUI

During screen transitions I disable user input, as the screen we are leaving does not want any more input and the screen we are going to may not quite be ready. So I was hoping that the 4.6 beta 20 release notes of:

UI: Allow users to enable / disable navigation on a global level (including submit / cancel keys). See: EventSystem.current.sendNavigationEvents

meant that it would also disable touch and mouse navigation events but it appears that these still go through.

So I’ve done some research and identified a few methods that could be used:

Continue reading How to disable touches / mouse clicks in uGUI

Working with multiple versions of Unity3D installed

As the number of projects you work on increases or you start to use betas such as the current Unity 4.6 betas you may find it useful to have multiple versions of unity installed on your machine at once. Fortunately this is very easy to do. You can even run multiple versions at once.

Installation

Mac: On the Mac Unity always installs into the Applications/Unity folder. Once installed you can just rename the Unity directory to reflect the version installed. Or as I do when I install a new version I rename my existing Unity directory to reflect it’s version.

Continue reading Working with multiple versions of Unity3D installed