Popups
Last updated
Last updated
Displays a popup in the inspector to select an input axis.
Supported property types
String
Int
Parameters
None.
Code Example
using UltimateAttributesPack;
public class InputAxisExample : MonoBehaviour
{
// Shows a popup menu to select a specific input axis (returns the index of the input axis)
[InputAxis]
public int intInputAxis;
// It can also be used on string variables to return the name of the input axis
[InputAxis]
public string stringInputAxis;
}
Displays a popup in the inspector to select a tag.
Supported property types
String
Parameters
None.
Code Example
using UltimateAttributesPack;
public class TagExample : MonoBehaviour
{
// Tag attribute displays a popup in the inspector to select a tag (only works with string)
[Tag]
public string tagName; // Returns the tag name
}
Displays a popup in the inspector to select a scene.
Supported property types
String
Int
Parameters
None.
Code Example
using UltimateAttributesPack;
public class SceneExample : MonoBehaviour
{
// Scene attribute dislays a popup in the inspector to select a scene (scenes must be in build settings)
[Scene]
public int sceneIndex; // Returns the index of the scene if the variable is an int
[Scene]
public string sceneName; // Returns the name of the scene if the variable is a string
}
Displays a button at the right of the variable in the inspector to select a predefined value in parameters. The variable can be changed to a value that is not a predefined value.
Supported property types
String
Float
Int
Parameters
Values
Code Example
using UltimateAttributesPack;
public class PredefinedValuesExample : MonoBehaviour
{
// PredefinedValues attribute displays a button at the right of the variable to open a popup menu and select one of multiples predefined values setted in params
// The value of the variable can be changed to a value that is not predefined in the params
[PredefinedValues(0, 2.5f, 5f, 10f, 33.3f)]
public float predefinedFloatValue;
// It also works with int and string
[PredefinedValues(0, 2, 5)]
public int predefinedIntValue;
[PredefinedValues(0, "Example Text", "Second Example Text")]
public string predefinedStringValue;
}
Displays a popup in the inspector to select a predefined value in parameters. The variable can't be changed to a value that is not a predefined value.
Supported property types
String
Float
Int
Parameters
Values
Code Example
using UltimateAttributesPack;
public class PredefinedValuesOnlyExample : MonoBehaviour
{
// PredefinedValuesOnly attribute displays a popup menu to select one of multiples predefined values setted in params
// The value of the variable can't be changed to a value that is not predefined in the params
[PredefinedValuesOnly(0, 2.5f, 5f, 10f, 33.3f)]
public float predefinedFloatValue;
// It also works with int and string
[PredefinedValuesOnly(0, 2, 5)]
public int predefinedIntValue;
[PredefinedValuesOnly(0, "Example Text", "Second Example Text")]
public string predefinedStringValue;
}