Definitto
1.1.0
The essential defines manager for the Unity game engine. API reference.
|
The list of defines. More...
Public Member Functions | |
string [] | GetEnabledDefineStrings (BuildTypeId buildTypeId, PlatformId platformId) |
Gets all enabled defines as an array of strings, suitable to be passed to Player Settings. More... | |
Define | Find (string name, bool raw=false) |
Find the first define, with the specified name. More... | |
bool | Contains (string define, bool raw=false) |
Does the list contain a define with the specified name? More... | |
int | IndexOf (Define define) |
The zero-based index of the first occurrence of define within the entire list, if found; otherwise, More... | |
bool | IsDefineEnabled (string defineName, BuildTypeId buildTypeId, PlatformId platformId, AggregationPolicy policy=AggregationPolicy.All, bool raw=false, bool ignoreBuiltIns=false) |
Determines whether the specified define is active for the specified buildTypeId . If there is no such define in the list, the system list of built-in defines is examined, unless the ignoreBuiltIns is set to true . More... | |
bool | IsDefineActive (string defineName, bool raw=false, bool ignoreBuiltIns=false) |
Determines whether the specified defineName is enabled for the currently active build type and platform. If there is no such define in the list, the system list of built-in defines is examined, unless the ignoreBuiltIns is set to true . More... | |
void | SetDefineEnabled (string defineName, BuildTypeId buildType, PlatformId platform, bool enabled=true, bool raw=false) |
Set a define active or inactive for a build target group and platform. More... | |
void | SetDefineEnabled (string defineName, BuildCategoryId buildCategoryId, PlatformId platformId, bool enabled=true, bool raw=false) |
Sets the define enabled for specified build category and platform. More... | |
void | SetDefineEnabled (string defineName, BuildTypeId buildTypeId, PlatformCategoryId platformCategoryId, bool enabled=true, bool raw=false) |
Sets the define enabled for specified build type and platform category. More... | |
void | SetDefineEnabled (string defineName, BuildCategoryId buildCategoryId, PlatformCategoryId platformCategoryId, bool enabled=true, bool raw=false) |
Sets the define enabled for specified build category and platform category. More... | |
void | SetDefineActive (string defineName, bool active=true, bool raw=false) |
Activate/deactivate the specified define for the current build type, on the currently active platform. More... | |
void | Remove (int index) |
Remove a define at specified index. More... | |
bool | Remove (string defineName, bool raw=false) |
Remove the define by its name. Only a single define with that name will be removed at most. More... | |
void | Move (int srcIndex, int dstIndex) |
Move the define within the list. More... | |
void | Add (Define define, bool raw=false) |
Add a new define to the end of the list. More... | |
Define | Add (string defineName, bool raw=false) |
Add a new define with specified defineName to the end of the list. More... | |
void | Insert (int index, Define define) |
Insert a new define at the specified index. More... | |
int | Clear () |
Clear all the defines in the list. More... | |
void | SortAlphabetically () |
Sorts the defines list alphabetically. More... | |
void | SortByPlatformState (PlatformId platformId) |
Sorts the defines list by state on platform. More... | |
IEnumerable< BuildTypeId > | ExpandToBuildTypeIds (BuildTypeId buildTypeId) |
Expand a possibly special value of specified buildTypeId . More... | |
IEnumerable< BuildTypeId > | ExpandToBuildTypeIds (IEnumerable< BuildTypeId > buildTypeIds) |
Expand the special values for specified buildTypeIds . More... | |
IEnumerable< BuildTypeId > | ExpandToBuildTypeIds (BuildCategoryId buildCategoryId) |
Expand the specified build category identifier to build type identifiers. More... | |
IEnumerable< PlatformId > | ExpandToPlatformIds (PlatformId platformId) |
Expand a possibly special value of specified platformId . More... | |
IEnumerable< PlatformId > | ExpandToPlatformIds (IEnumerable< PlatformId > platformTypes) |
Expand the special values for specified platformTypes . More... | |
IEnumerable< PlatformId > | ExpandToPlatformIds (PlatformCategoryId platformCategoryId) |
Expand a possibly special value of specified platformCategoryId to list of platform identifiers. More... | |
Static Public Member Functions | |
static Defines | New () |
Create a new instance of defines list. Essentially a shortcut for the ScriptableObject.CreateInstance<Defines> function. More... | |
Public Attributes | |
const string | MenuName = DefinittoInfo.Title + "/Defines" |
A menu name for the asset creation. More... | |
const int | CountMax = 1024 |
The maximum total number of defines in the list possible. More... | |
const int | DefinesCountMax = CountMax |
Deprecated. Please, use the CountMax constant instead. More... | |
const string | MaximumCountReachedMessage = "A maximum number of defines ({0}) was already reached for list '{1}'." |
A message of the maximum count reached. The first formatting argument should be CountMax, the second should be the defines' name. More... | |
const string | AssetExtension = "asset" |
The extension (without a dot character) for the defines assets. More... | |
const string | MainName = "Defines" |
The name of the main defines list as in the Resources folder. More... | |
const string | MainFilename = MainName + "." + AssetExtension |
The filename of the main defines list. More... | |
const string | MainResourceSubfolderName = DefinittoInfo.CamelTitle |
The resources sub-folder, where the main defines resource should be stored. More... | |
const string | MainResourceFilePath = MainResourceSubfolderName + "/" + MainFilename |
The resource path for the main defines list with extension. More... | |
const string | MainResourcePath = MainResourceSubfolderName + "/" + MainName |
The resource path for the main defines list without extension. More... | |
const string | ListProp = "_List" |
The name of the list property containing the defines. More... | |
Static Public Attributes | |
static readonly DefinesEvent | Loaded = new DefinesEvent() |
An event is generated, when a new defines list was successfully and fully loaded. More... | |
static readonly DefinesEvent | Unloading = new DefinesEvent() |
An event is generated, when a defines list is starting to unload. More... | |
static readonly DefinesEvent | MainDefinesBecameAvailable = new DefinesEvent() |
An event is invoked, when a new defines list has become the main one. More... | |
static readonly DefinesEvent | MainDefinesBecameUnavailable = new DefinesEvent() |
An event is invoked, when a defines list has lost its status as the main one. More... | |
Properties | |
static IEnumerable< Defines > | All [get] |
All of the currently loaded define lists. More... | |
DefinesEvent | Changed [get] |
A general change event. Invoked whenever the list or its defines are changed in some way. More... | |
DefineStateEvent | DefineStateChanged [get] |
One of the defines has changed its state. More... | |
DefinesEvent | ActiveBuildTypeChanged [get] |
The active build type was changed. More... | |
DefinesEvent | ActivePlatformChanged [get] |
The active platform was changed. More... | |
BuildTypeId | ActiveBuildTypeId [get, set] |
Get the active build type of the defines list. More... | |
BuildType | ActiveBuildType [get] |
Gets the type of the active build. Uses the system settings for lookup. More... | |
BuildCategoryId | ActiveBuildCategoryId [get, set] |
The active build category identifier. More... | |
BuildCategory | ActiveBuildCategory [get] |
Gets the active build category. More... | |
PlatformId | ActivePlatformId [get, set] |
Gets the type of the active platform identifier. A cached version is returned during runtime (Play) mode. More... | |
Platform | ActivePlatform [get] |
Gets the active platform. Cached result is returned during the Player mode. More... | |
PlatformCategoryId | ActivePlatformCategoryId [get] |
The active platform category identifier. More... | |
PlatformCategory | ActivePlatformCategory [get] |
Gets the active platform category. More... | |
static bool | HasMain [get] |
Is the main defines list currently available and fully loaded? More... | |
bool | IsMain [get] |
Is this list currently the main one? More... | |
static Defines | Main [get, set] |
Get the main defines list instance. If the main list is not currently loaded, this method will try to load one. The setter is used for internal purposes only. More... | |
bool | IsBuiltIn [get] |
Is this a built-in defines list? More... | |
bool | IsFullyLoaded [get] |
Was the defines list fully loaded? Used internally in the loading process. More... | |
bool | IsEmpty [get] |
Is this defines list empty? More... | |
bool | NeedsApplication [get, set] |
Gets or sets a value indicating whether this Defines needs application. More... | |
IEnumerable< string > | RemovedDefines [get] |
The history of all removed defines. Used internally to exclude the fetching of those defines from Player Settings. More... | |
string [] | ActiveDefineStrings [get] |
Gets the define strings enabled for the currently active build type and platform. Cached. More... | |
int | Count [get] |
The number of defines in the list. More... | |
Define | this[int index] [get] |
Get the define with a specified index. More... | |
Define | this[string name] [get] |
Get the first non-muted define with the provided name . More... | |
The list of defines.
You should always get the main defines list via the Defines.Main property.
All other ways of loading are not supported.
void Turbanov.Toolworks.Definitto.Defines.Add | ( | Define | define, |
bool | raw = false |
||
) |
Add a new define to the end of the list.
If there is already a define with such name in the list Exception is raised.
Adding defines during the Play mode is not allowed.
define | The define to add to the end of the list. |
raw | Should the Define.IsMuted status be ignored, when testing against existing defines? |
Define Turbanov.Toolworks.Definitto.Defines.Add | ( | string | defineName, |
bool | raw = false |
||
) |
Add a new define with specified defineName to the end of the list.
If a define with such name already exists, nothing is performed and the existing define is returned.
Adding defines during the Play mode is not allowed.
defineName | The new define's name. |
raw | Should the Define.IsMuted status be ignored, when testing against existing defines? |
int Turbanov.Toolworks.Definitto.Defines.Clear | ( | ) |
Clear all the defines in the list.
bool Turbanov.Toolworks.Definitto.Defines.Contains | ( | string | define, |
bool | raw = false |
||
) |
Does the list contain a define with the specified name?
Only non-muted defines will be considered unless the raw parameter is set to true
.
define | The define name to check. |
raw | Should the Define.IsMuted status be ignored? |
IEnumerable<BuildTypeId> Turbanov.Toolworks.Definitto.Defines.ExpandToBuildTypeIds | ( | BuildTypeId | buildTypeId | ) |
Expand a possibly special value of specified buildTypeId .
buildTypeId | The build type identifier. |
IEnumerable<BuildTypeId> Turbanov.Toolworks.Definitto.Defines.ExpandToBuildTypeIds | ( | IEnumerable< BuildTypeId > | buildTypeIds | ) |
Expand the special values for specified buildTypeIds .
buildTypeIds | The build type identifiers. |
IEnumerable<BuildTypeId> Turbanov.Toolworks.Definitto.Defines.ExpandToBuildTypeIds | ( | BuildCategoryId | buildCategoryId | ) |
Expand the specified build category identifier to build type identifiers.
buildCategoryId | The build category identifier. |
IEnumerable<PlatformId> Turbanov.Toolworks.Definitto.Defines.ExpandToPlatformIds | ( | PlatformId | platformId | ) |
Expand a possibly special value of specified platformId .
platformId | The platform identifier. |
IEnumerable<PlatformId> Turbanov.Toolworks.Definitto.Defines.ExpandToPlatformIds | ( | IEnumerable< PlatformId > | platformTypes | ) |
Expand the special values for specified platformTypes .
platformTypes | The platform types to expand. |
IEnumerable<PlatformId> Turbanov.Toolworks.Definitto.Defines.ExpandToPlatformIds | ( | PlatformCategoryId | platformCategoryId | ) |
Expand a possibly special value of specified platformCategoryId to list of platform identifiers.
platformCategoryId | The platform category identifier. |
Define Turbanov.Toolworks.Definitto.Defines.Find | ( | string | name, |
bool | raw = false |
||
) |
Find the first define, with the specified name.
The muted defines won't be considered, unless the raw is set to true
.
name | The name of the define to search for. |
raw | Should the Define.IsMuted status be ignored? |
null
, if there is no such define in the list. string [] Turbanov.Toolworks.Definitto.Defines.GetEnabledDefineStrings | ( | BuildTypeId | buildTypeId, |
PlatformId | platformId | ||
) |
Gets all enabled defines as an array of strings, suitable to be passed to Player Settings.
buildTypeId | The build type identifier. |
platformId | The platform identifier. |
int Turbanov.Toolworks.Definitto.Defines.IndexOf | ( | Define | define | ) |
The zero-based index of the first occurrence of define within the entire list, if found; otherwise,
-1
.
define | The define to look for. Can be muted or not. |
void Turbanov.Toolworks.Definitto.Defines.Insert | ( | int | index, |
Define | define | ||
) |
Insert a new define at the specified index.
If there is already a define with such name in the list Exception is raised.
Adding defines during the Play mode is not allowed.
index | The index to insert at. |
define | The define to insert. |
bool Turbanov.Toolworks.Definitto.Defines.IsDefineActive | ( | string | defineName, |
bool | raw = false , |
||
bool | ignoreBuiltIns = false |
||
) |
Determines whether the specified defineName is enabled for the currently active build type and platform. If there is no such define in the list, the system list of built-in defines is examined, unless the ignoreBuiltIns is set to true
.
defineName | The name of the define to examine. |
raw | Should the Define.IsMuted and Define.IsValid statuses be ignored? |
ignoreBuiltIns | Should the built-in defines be ignored? |
true
if the define is available and currently enabled; otherwise, false
.bool Turbanov.Toolworks.Definitto.Defines.IsDefineEnabled | ( | string | defineName, |
BuildTypeId | buildTypeId, | ||
PlatformId | platformId, | ||
AggregationPolicy | policy = AggregationPolicy.All , |
||
bool | raw = false , |
||
bool | ignoreBuiltIns = false |
||
) |
Determines whether the specified define is active for the specified buildTypeId . If there is no such define in the list, the system list of built-in defines is examined, unless the ignoreBuiltIns is set to true
.
defineName | The name of the define to examine. |
buildTypeId | The build type identifier. |
platformId | The platform identifier. |
policy | The policy to use when deriving the define status, if platformId is PlatformId.All. |
raw | Should the Define.IsMuted and Define.IsValid statuses be ignored? |
ignoreBuiltIns | Should the built-in defines be ignored? |
true
if the define is available and enabled; otherwise, false
.void Turbanov.Toolworks.Definitto.Defines.Move | ( | int | srcIndex, |
int | dstIndex | ||
) |
Move the define within the list.
Moving defines during the Play mode is not allowed.
srcIndex | The source index to get element from. |
dstIndex | The destination index to insert element into. |
|
static |
Create a new instance of defines list. Essentially a shortcut for the ScriptableObject.CreateInstance<Defines> function.
void Turbanov.Toolworks.Definitto.Defines.Remove | ( | int | index | ) |
Remove a define at specified index.
Removing defines during the Play mode is not allowed.
index | The index of the define to remove. |
bool Turbanov.Toolworks.Definitto.Defines.Remove | ( | string | defineName, |
bool | raw = false |
||
) |
Remove the define by its name. Only a single define with that name will be removed at most.
If there is no such define, the function exits silently performing to actions.
Removing defines during the Play mode is not allowed.
defineName | The name of the define to remove. |
raw | Should the Define.IsMuted status be ignored? |
false
is returned. void Turbanov.Toolworks.Definitto.Defines.SetDefineActive | ( | string | defineName, |
bool | active = true , |
||
bool | raw = false |
||
) |
Activate/deactivate the specified define for the current build type, on the currently active platform.
If there is no define with defineName currently in the list and active is true
, it will be created and appended to the end.
Changing a define's state during the Play mode is not allowed.
defineName | The define name. |
active | Activate or deactivate. |
raw | Should the Define.IsMuted and Define.IsValid statuses be ignored? |
void Turbanov.Toolworks.Definitto.Defines.SetDefineEnabled | ( | string | defineName, |
BuildTypeId | buildType, | ||
PlatformId | platform, | ||
bool | enabled = true , |
||
bool | raw = false |
||
) |
Set a define active or inactive for a build target group and platform.
If there is no define with defineName currently in the list and enabled is true
, it will be created and appended to the end.
Changing a define's state during the Play mode is not allowed.
defineName | The name of the define to be changed. |
buildType | The build type in question. |
platform | The platform in question. |
enabled | Should the define be activated or disabled? |
raw | Should the Define.IsMuted and Define.IsValid statuses be ignored? |
void Turbanov.Toolworks.Definitto.Defines.SetDefineEnabled | ( | string | defineName, |
BuildCategoryId | buildCategoryId, | ||
PlatformId | platformId, | ||
bool | enabled = true , |
||
bool | raw = false |
||
) |
Sets the define enabled for specified build category and platform.
If there is no define with defineName currently in the list and enabled is true
, it will be created and appended to the end.
Changing a define's state during the Play mode is not allowed.
defineName | Define name. |
buildCategoryId | Build category identifier. |
platformId | Platform identifier. |
enabled | If set to true enabled. |
raw | Should the Define.IsMuted and Define.IsValid statuses be ignored? |
void Turbanov.Toolworks.Definitto.Defines.SetDefineEnabled | ( | string | defineName, |
BuildTypeId | buildTypeId, | ||
PlatformCategoryId | platformCategoryId, | ||
bool | enabled = true , |
||
bool | raw = false |
||
) |
Sets the define enabled for specified build type and platform category.
If there is no define with defineName currently in the list and enabled is true
, it will be created and appended to the end.
Changing a define's state during the Play mode is not allowed.
defineName | Define name. |
buildTypeId | Build type identifier. |
platformCategoryId | Platform category identifier. |
enabled | If set to true the define should be enabled; otherwise, disabled. |
raw | Should the Define.IsMuted and Define.IsValid statuses be ignored? |
void Turbanov.Toolworks.Definitto.Defines.SetDefineEnabled | ( | string | defineName, |
BuildCategoryId | buildCategoryId, | ||
PlatformCategoryId | platformCategoryId, | ||
bool | enabled = true , |
||
bool | raw = false |
||
) |
Sets the define enabled for specified build category and platform category.
If there is no define with defineName currently in the list and enabled is true
, it will be created and appended to the end.
Changing a define's state during the Play mode is not allowed.
defineName | Define name. |
buildCategoryId | Build category identifier. |
platformCategoryId | Platform category identifier. |
enabled | If set to true enabled. |
raw | Should the Define.IsMuted and Define.IsValid statuses be ignored? |
void Turbanov.Toolworks.Definitto.Defines.SortAlphabetically | ( | ) |
Sorts the defines list alphabetically.
The function is for Editor only.
void Turbanov.Toolworks.Definitto.Defines.SortByPlatformState | ( | PlatformId | platformId | ) |
Sorts the defines list by state on platform.
The function is for Editor only.
const string Turbanov.Toolworks.Definitto.Defines.AssetExtension = "asset" |
The extension (without a dot character) for the defines assets.
const int Turbanov.Toolworks.Definitto.Defines.CountMax = 1024 |
The maximum total number of defines in the list possible.
const int Turbanov.Toolworks.Definitto.Defines.DefinesCountMax = CountMax |
Deprecated. Please, use the CountMax constant instead.
const string Turbanov.Toolworks.Definitto.Defines.ListProp = "_List" |
The name of the list property containing the defines.
|
static |
An event is generated, when a new defines list was successfully and fully loaded.
|
static |
An event is invoked, when a new defines list has become the main one.
|
static |
An event is invoked, when a defines list has lost its status as the main one.
const string Turbanov.Toolworks.Definitto.Defines.MainFilename = MainName + "." + AssetExtension |
The filename of the main defines list.
const string Turbanov.Toolworks.Definitto.Defines.MainName = "Defines" |
The name of the main defines list as in the Resources folder.
const string Turbanov.Toolworks.Definitto.Defines.MainResourceFilePath = MainResourceSubfolderName + "/" + MainFilename |
The resource path for the main defines list with extension.
const string Turbanov.Toolworks.Definitto.Defines.MainResourcePath = MainResourceSubfolderName + "/" + MainName |
The resource path for the main defines list without extension.
const string Turbanov.Toolworks.Definitto.Defines.MainResourceSubfolderName = DefinittoInfo.CamelTitle |
The resources sub-folder, where the main defines resource should be stored.
const string Turbanov.Toolworks.Definitto.Defines.MaximumCountReachedMessage = "A maximum number of defines ({0}) was already reached for list '{1}'." |
A message of the maximum count reached. The first formatting argument should be CountMax, the second should be the defines' name.
const string Turbanov.Toolworks.Definitto.Defines.MenuName = DefinittoInfo.Title + "/Defines" |
A menu name for the asset creation.
|
static |
An event is generated, when a defines list is starting to unload.
|
get |
Gets the active build category.
The active build category.
|
getset |
The active build category identifier.
Setting the active build category during the Play mode is not allowed.
The active build category identifier.
|
get |
Gets the type of the active build. Uses the system settings for lookup.
The type of the active build or null
if an error has occurred.
|
get |
The active build type was changed.
|
getset |
Get the active build type of the defines list.
Setting the active build type during the Play mode is not allowed.
|
get |
Gets the define strings enabled for the currently active build type and platform. Cached.
Doesn't include the list of active built-in defines. To get the active built-in defines try using the EditorUserBuildSettingsUtils.ActiveBuiltInDefines property.
The currently active defines as an array of strings.
|
get |
Gets the active platform. Cached result is returned during the Player mode.
The active platform or null
, if there is not supported active platform.
|
get |
Gets the active platform category.
The active platform category.
|
get |
The active platform category identifier.
The active platform category identifier.
|
get |
The active platform was changed.
|
getset |
Gets the type of the active platform identifier. A cached version is returned during runtime (Play) mode.
Setting the active platform during the Play mode is not allowed.
The identifier of the active platform. If there is no supported active platform, PlatformId.None is returned.
|
staticget |
All of the currently loaded define lists.
|
get |
A general change event. Invoked whenever the list or its defines are changed in some way.
|
get |
The number of defines in the list.
|
get |
One of the defines has changed its state.
|
staticget |
Is the main defines list currently available and fully loaded?
|
get |
Is this a built-in defines list?
true
if this instance is a built-in list; otherwise, false
.
|
get |
Is this defines list empty?
true
if this instance has no defines in it; otherwise, false
.
|
get |
Was the defines list fully loaded? Used internally in the loading process.
|
get |
Is this list currently the main one?
|
staticgetset |
Get the main defines list instance. If the main list is not currently loaded, this method will try to load one. The setter is used for internal purposes only.
|
getset |
Gets or sets a value indicating whether this Defines needs application.
Not the main defines lists always return true
here.
The property is used internally. You should never set or reset it.
true
if needs application; otherwise, false
.
|
get |
The history of all removed defines. Used internally to exclude the fetching of those defines from Player Settings.
|
get |
Get the define with a specified index.
index | The index of the define. |
|
get |
Get the first non-muted define with the provided name .
name | The name of the define to get. |