ExcludeFromPresetAttribute
Prevents creating a Preset from instances of a class, or excludes a serialized field from the Presets of its class.
阅读时间4 分钟最后更新于 4 天前
Definition
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
- Inherits from: Attribute
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Field, Inherited = false)]public class ExcludeFromPresetAttribute : Attribute
Remarks
Apply to a class to prevent creating Presets from instances of that class.
[ExcludeFromPreset]Apply to a serialized field to keep that field out of the Presets of its class, while you can still create Presets of the class. A Preset doesn't record the field or any data nested in it, and applying a Preset doesn't change the field's value on the target object. This also applies to Presets saved before you added the attribute. Use this attribute when a class has per-instance data, such as identifiers or object references, next to settings that you want to share through Presets.
[ExcludeFromPreset]This attribute targets classes and fields.
This attribute has no effect on a field that has the SerializeReference attribute, or on the fields of an object that a field holds. Presets record and apply those fields like any other field.
[SerializeReference]