Version 2.1.0.0

Odin has a dedicated attribute overview with examples

WrapAttribute class

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector.Attributes
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter | AttributeTargets.All, AllowMultiple = false, Inherited = true)]
public sealed class WrapAttribute : Attribute, _Attribute

Wrap is used on most primitive property, and allows for wrapping the value when it goes out of the defined range.

Use this when you want a value that goes around in circle, like for example an angle.

Inheritance
  • System.Object
  • System.Attribute
  • WrapAttribute
Remarks

note

Currently unsigned primitives are not supported.

Example

The following example show how Wrap is used on a property.

public class MyComponent : MonoBehaviour
{
	[Wrap(-100, 100)]
	public float MyFloat;
}

Constructors

WrapAttribute(Double, Double)
Wraps the value of the property round when the values goes out of range.
public WrapAttribute(double min, double max)
Parameters
System.Double min

The lowest value for the property.

System.Double max

The highest value for the property.

Fields

Max
The highest value for the property.
public double Max
Min
The lowest value for the property.
public double Min

This website is brand new and built with the Odin 2.1 beta in mind. This means you might discover some features such as attribute expressions that are only available in the beta.

You can download the 2.1 beta from here and read the patch-notes here.