Skip to main content

Class ScriptableObjectIdAttribute

Attribute used to automatically assign persistent GUID of a ScriptableObject in the inspector.

public class ScriptableObjectIdAttribute : PropertyAttribute

Inheritance​

Remarks​

This attribute should be applied to a string field inside a ScriptableObject or Unity asset. At edit time in the Unity Editor, the field will automatically be assigned the asset's GUID as recorded in the Asset Database. The primary purpose is to embed the asset's GUID into its serialized data, so that the identifier can be retained and referenced even in a built player where the Asset Database is no longer available.