RegisterButton (+3 overloads)

Registers the information provided to the radial menu.

Basic Callback
using UnityEngine;

public class RadialMenuExample : MonoBehaviour
{
	public UltimateRadialButtonInfo buttonInfo;

	void Start ()
	{
		UltimateRadialMenu.RegisterButton( "ExampleMenu", MyCallback, buttonInfo );
	}
	
	void MyCallback ()
	{
		Debug.Log( "MyCallback called!" );
	}
}
int Callback
using UnityEngine;

public class RadialMenuExample : MonoBehaviour
{
	public UltimateRadialButtonInfo buttonInfo;

	void Start ()
	{
		// This value can be set in the inspector, or here before registering the information to the radial menu.
		buttonInfo.id = 101;
		UltimateRadialMenu.RegisterButton( "ExampleMenu", UseItem, buttonInfo );
	}
	
	void UseItem ( int id )
	{
		// This is where you can check your item dictionary.
		Debug.Log( $"UseItem called for item: {id}" );
	}
}
string Callback
using UnityEngine;

public class RadialMenuExample : MonoBehaviour
{
	public UltimateRadialButtonInfo buttonInfo;

	void Start ()
	{
		// This value can be set in the inspector, or here before registering the information to the radial menu.
		buttonInfo.key = "HealthPotion";
		UltimateRadialMenu.RegisterButton( "ExampleMenu", UseItem, buttonInfo );
	}
	
	void UseItem ( string key )
	{
		// This is where you can check your item dictionary.
		Debug.Log( $"UseItem called for: {key}" );
	}
}

Last updated