DisplayAsString is used on any property, and displays a string in the inspector as text.

Use this for when you want to show a string in the inspector, but not allow for any editing.

namespace Sirenix.OdinInspector
[AttributeUsageAttribute((AttributeTargets)384, AllowMultiple = False, Inherited = True)]
public sealed class DisplayAsStringAttribute : Attribute


Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector

See Also


Definition Description
DisplayAsStringAttribute() Displays the property as a string in the inspector.
DisplayAsStringAttribute(bool) Displays the property as a string in the inspector.


Return Type Definition Description
bool Overflow If true the string will overflow to multiple lines, if there's not enough space when drawn.


The following example shows how DisplayAsString is used to display a string property as text in the inspector.

public class MyComponent : MonoBehaviour
	public string MyInt = 5;

	// You can combine with  to display a message in the inspector.
	[DisplayAsString, HideLabel]
	public string MyMessage = "This string will be displayed as text in the inspector";
	public string InlineMessage = "This string is very long, but has been configured to not overflow.";