Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

PersistentVariablesSource

class in Unity.SmartStrings.Extensions


Implements interfaces:ISerializationCallbackReceiver, ISource

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Provides global or local values that do not need to be passed in as arguments when formatting a string. The smart string should take the format {groupName.variableName}. e.g {global.player-score}. Note: The group name and variable names must not contain any spaces.

Static Properties

Property Description
IsUpdating Whether PersistentVariablesSource.BeginUpdating has been called without a matching PersistentVariablesSource.EndUpdating. This can be used when updating the value of multiple IVariable in order to do a single update after the updates instead of 1 per change.

Properties

Property Description
Count The number of VariablesGroupAsset that are used for global variables.
IsReadOnly Implemented as part of IDictionary but not used. Always returns false.
Keys The global variable group names.
this[string] The global variable group that matches name.
Values The global variable groups in this source.

Public Methods

Method Description
Add Adds a global variable group to the source.
Clear Removes all global variables.
ContainsKey Returns true if a global variable group is found with the same name.
CopyTo Copies all global variable groups into the provided array starting at arrayIndex.
GetEnumerator Returns an enumerator for all the global variables in the source.
Remove Removes the group with the matching name.
TryGetValue Returns true if a global variable group could be found with a matching name, or false if one could not.

Static Methods

Method Description
BeginUpdating Indicates that multiple IVariable will be changed and localized string should wait for PersistentVariablesSource.EndUpdate before updating. See PersistentVariablesSource.EndUpdating and PersistentVariablesSource.EndUpdate. Note: PersistentVariablesSource.BeginUpdating and PersistentVariablesSource.EndUpdating can be nested, PersistentVariablesSource.EndUpdate will only be called after the last PersistentVariablesSource.EndUpdating.
EndUpdating Indicates that updates to IVariable have finished and sends the PersistentVariablesSource.EndUpdate event. Note: PersistentVariablesSource.BeginUpdating and PersistentVariablesSource.EndUpdating can be nested, PersistentVariablesSource.EndUpdate will only be called after the last PersistentVariablesSource.EndUpdating.
UpdateScope Creates a PersistentVariablesSource.BeginUpdating and PersistentVariablesSource.EndUpdating scope.

Events

Event Description
EndUpdate Raised after the final PersistentVariablesSource.EndUpdating call. This can be used when you wish to respond to value change events but wish to do a single update at the end instead of 1 per change. For example, if you wanted to change the value of multiple global variables that a smart string was using then changing each value would result in a new string being generated, by using begin and end the string generation can be deferred until the final change so that only 1 update is performed.