Scripting API
Scripting API
PreferencesAttribute
Class in Abyss.Core, from Abyss.Core.
Marks a partial class as a player's preferences: what Preferences.Save keeps and Preferences.Load reads back, as name.json in the player's folder.
public sealed class PreferencesAttribute : AttributeRemarks
The source generator writes how it is kept, so nothing is found by reflection, which a built game, compiled ahead of time, does not have. Its public fields and properties with a getter and a setter are kept: numbers, bool, string, enums, Vector2 to Vector4 and Quaternion, arrays and lists of those, and other classes marked PreferencesAttribute; anything else is not kept, and the build warns where it is declared (ABYSS020).
A file written before the class changed still reads: a member it does not have keeps the value the class starts it with, and one it has that the class does not is passed over. A member renamed keeps its value where it says its old name, with FormerlySerializedAsAttribute.
The name is the file's, kept as the class is renamed: graphics is graphics.json. A class kept only inside another's needs none.
Constructors
PreferencesAttribute
public PreferencesAttribute()A class kept only inside another's.
PreferencesAttribute
public PreferencesAttribute(string name)A class kept as name.json.
Parameters
name: The file's name, without.json: a path under the player's folder, its parts joined by/.
Properties
Name
public string? Name { get; }The file's name, without .json; null for a class kept only inside another's.
