Last updated
Last updated
The Ultimate Radial Menu Input Manager contains all the basic input types and functions. However, sometimes in your project you may have a very specific way that you want the Ultimate Radial Menu to receive input. You can get the radial menu to work with your custom input very easily! Let's see how.
To create your custom input manager, create a new script inside your project and name it. For this example, we will create a script with the name: CustomInputManager. After the script is created, change it's inherited type to UltimateRadialMenuInputManager.
After creating your script, now you will want to choose which of the input types you want to override. For this example we will create an override for the Controller Input of the input manager, but you can override any of the methods listed .
First, let's override the ControllerInput function.
At first glance, the function and parameters might seem confusing! Don't worry though! The code is very simple and straight forward. Let's go over the parameters and see what each of them is for.
All changes to these parameters (excluding the radialMenuIndex value) will be stored and sent back to the Update function for processing and sending to the radial menus in the scene.
Now that we have our script created and our override void ready for some custom logic, let's add some code to get the radial menu processing the input that we are looking for.
For this example, we will adjust the controller input so that it will not reset back to center when the controller joystick has been released. In this way the radial menu will continue to process the last known input direction of the joystick even when the joystick has been released. So the first thing to do would be to create a variable that can store the last known input value so that it can be sent to the input manager.
After saving the above script, simply replace the current Ultimate Radial Menu Input Manager that is located on the EventSystem object in your scene with this one. Then enable the Controller Input option and you should see the new input logic being used.
enableMenu
This parameter allows you tell the input manager if you want the radial menu to be enabled on this frame or not. For instance, if you want the menu to be enabled when the user presses the left trigger of the controller, then you can check when it has been pressed and set enableMenu to true to enable the radial menu.
disableMenu
The exact opposite of the enableMenu parameter. Determines if you want the radial menu disabled this frame or not.
input
The input value that should be processed. In this example we will use the controller input, but you will set this to what ever input you are needing to interact with the radial menu.
distance
The distance of the input from the radial menu.
inputDown
The state of the interact input button being pressed down this frame.
inputUp
The state of the interact input button being released this frame.
radialMenuIndex
The index of the radial menu in the UltimateRadialMenuInformations list on the input manager. Useful for checking specifics of the radial menu being interacted with.
In this short tutorial we'll go over the basics of how to create a custom input manager for your project.