Skip to main content

Class SettingsBuildTargetCollection<TSetting, TSelf>

A base container class that holds and manages Settings instances for each Unity BuildTargetGroup. This class is responsible for managing multiple settings instances, each associated with a specific build target group.

public abstract class SettingsBuildTargetCollection<TSetting, TSelf> : ScriptableObject where TSetting : Settings<TSetting, TSelf> where TSelf : SettingsBuildTargetCollection<TSetting, TSelf>

Type Parameters​

NameTypeDescription
TSettingThe specific settings type that is stored in this collection.
TSelfThe collection type itself..

Inheritance​

Properties​

attribute​

The [Settings] attribute applied to the derived settings collection class.

public static SettingsAttribute attribute { get; }

Property Value​

SettingsAttribute

instance​

Singleton instance of the settings collection.

public static TSelf instance { get; }

Property Value​

TSelf

platformAttribute​

The [SettingsBuildTargetSelection] attribute applied to the derived settings collection class.

public static SettingsBuildTargetSelectionAttribute platformAttribute { get; }

Property Value​

SettingsBuildTargetSelectionAttribute

Methods​

CreateDefaultSettingsForBuildTarget(BuildTargetGroup)​

Creates a default settings instance for a given build target group.

public void CreateDefaultSettingsForBuildTarget(BuildTargetGroup targetGroup)

Parameters​

NameTypeDescription
targetGroupBuildTargetGroupThe build target group.

GetOrCreateSettingsForBuildTargetGroup(BuildTargetGroup)​

Retrieves or creates a settings instance for a specific build target group.

public TSetting GetOrCreateSettingsForBuildTargetGroup(BuildTargetGroup targetGroup)

Parameters​

NameTypeDescription
targetGroupBuildTargetGroupThe build target group.

Returns​

TSetting — The settings instance for the target group.

GetSettingsForBuildTargetGroup(BuildTargetGroup)​

Retrieves the settings instance for a specific build target group.

public TSetting GetSettingsForBuildTargetGroup(BuildTargetGroup targetGroup)

Parameters​

NameTypeDescription
targetGroupBuildTargetGroupThe build target group.

Returns​

TSetting — The settings instance for the target group, or null if not found.

HasSettingsForBuildTargetGroup(BuildTargetGroup)​

Checks whether a settings instance exists for a given build target group.

public bool HasSettingsForBuildTargetGroup(BuildTargetGroup targetGroup)

Parameters​

NameTypeDescription
targetGroupBuildTargetGroupThe build target group.

Returns​

bool — True if the settings exist, otherwise false.

Initialize()​

Initializes and loads the settings instance, creating one if necessary.

protected static TSelf Initialize()

Returns​

TSelf — The loaded or newly created instance of TSelf.

IsBuildTargetSupported(BuildTargetGroup)​

Checks whether a specific build target is supported.

public bool IsBuildTargetSupported(BuildTargetGroup targetGroup)

Parameters​

NameTypeDescription
targetGroupBuildTargetGroupThe build target group to check.

Returns​

bool — True if the target group is supported; otherwise, false.

OnAfterDeserialize()​

Restores the dictionary from serialized lists after deserialization.

public void OnAfterDeserialize()

OnBeforeSerialize()​

Prepares the dictionary for serialization by storing its keys and values in lists.

public void OnBeforeSerialize()
  • Properties
    • attribute
    • instance
    • platformAttribute
  • Methods
    • CreateDefaultSettingsForBuildTarget(BuildTargetGroup)
    • GetOrCreateSettingsForBuildTargetGroup(BuildTargetGroup)
    • GetSettingsForBuildTargetGroup(BuildTargetGroup)
    • HasSettingsForBuildTargetGroup(BuildTargetGroup)
    • Initialize()
    • IsBuildTargetSupported(BuildTargetGroup)
    • OnAfterDeserialize()
    • OnBeforeSerialize()