Odin has a dedicated attribute overview with examples

AssetsOnlyAttribute 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 AssetsOnlyAttribute : Attribute, _Attribute

AssetsOnly is used on object properties, and restricts the property to project assets, and not scene objects.

Use this when you want to ensure an object is from the project, and not from the scene.

  • System.Object
  • System.Attribute
  • AssetsOnlyAttribute

The following example shows a component with a game object property, that must be a prefab from the project, and not a scene object.

public MyComponent : MonoBehaviour
	public GameObject MyPrefab;


public AssetsOnlyAttribute()

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.