Class AchievementDefinitionCreator.Input
Everything one authored achievement is made of, plus where it lands.
Inherited Members
Namespace: Serenity.Achievements.Infrastructure.Editor.Builder
Assembly: Serenity.UnityAchievements.Infrastructure.Editor.dll
Syntax
public sealed class AchievementDefinitionCreator.Input
Remarks
Mirrors UnityAchievementDefinition's own fields one for one rather than grouping them, so a Studio detail pane can bind a form to this and ApplyTo(UnityAchievementDefinition) stays a flat copy with nothing to interpret.
Constructors
Input()
Declaration
public Input()
Fields
Condition
What unlocks the achievement, or null when only a code unlock or an UnlockAchievementSignal
does.
Declaration
public AchievementCondition Condition
Field Value
| Type | Description |
|---|---|
| AchievementCondition |
Remarks
Assigned to the created asset BY REFERENCE, because an authored tree is a live managed object a
window is editing rather than a value to copy. Handing the same tree to two Inputs gives two
assets one tree, and the counters a signal or duration node accumulates would then be shared
between them — which is exactly why SourceToClone exists instead of
Condition = source.Condition.
The same reference-ness has a second consequence: a caller that reached this tree through CaptureFrom(UnityAchievementDefinition) and edits it in place is editing the ASSET, not a copy of it, without going through Update(UnityAchievementDefinition, Input) at all. Call BeginEdit(UnityAchievementDefinition, string) on that asset first, or the edit lands with no undo entry behind it.
DescriptionKey
The description, or the localization key standing for it when IsTranslating is on.
Declaration
public string DescriptionKey
Field Value
| Type | Description |
|---|---|
| string |
DisplayOrder
Ordering hint used when listing achievements. Lower values are listed first.
Declaration
public int DisplayOrder
Field Value
| Type | Description |
|---|---|
| int |
EpicAchievementId
The Epic Online Services achievement identifier. Blank means not mirrored.
Declaration
public string EpicAchievementId
Field Value
| Type | Description |
|---|---|
| string |
Grade
The trophy tier tiered platforms award.
Declaration
public TrophyGrade Grade
Field Value
| Type | Description |
|---|---|
| TrophyGrade |
Icon
The icon the listing draws.
Declaration
public Sprite Icon
Field Value
| Type | Description |
|---|---|
| Sprite |
Id
The achievement's Id: the key every unlock row is stored under, and the stem of its file name. Held to a slug by AchievementAuthoringRules.
Declaration
public string Id
Field Value
| Type | Description |
|---|---|
| string |
IsHidden
Whether the achievement stays concealed in the listing until it is unlocked.
Declaration
public bool IsHidden
Field Value
| Type | Description |
|---|---|
| bool |
IsTranslating
Whether NameKey and DescriptionKey are localization keys rather than literal text.
Declaration
public bool IsTranslating
Field Value
| Type | Description |
|---|---|
| bool |
NameKey
The display name, or the localization key standing for it when IsTranslating is on.
Declaration
public string NameKey
Field Value
| Type | Description |
|---|---|
| string |
Points
The Serenity points the unlock awards. Never negative.
Declaration
public int Points
Field Value
| Type | Description |
|---|---|
| int |
ProgressTarget
The progress numerator that unlocks the achievement. Zero makes it single-step.
Declaration
public long ProgressTarget
Field Value
| Type | Description |
|---|---|
| long |
PsnTrophyId
The PlayStation Network trophy identifier. Blank means not mirrored.
Declaration
public string PsnTrophyId
Field Value
| Type | Description |
|---|---|
| string |
RegisterAsAddressables
Whether the created asset is registered in the Serenity Addressables group under the achievements label — which is how the module discovers it at all. Tests pass false.
Declaration
public bool RegisterAsAddressables
Field Value
| Type | Description |
|---|---|
| bool |
SourceToClone
An existing achievement this run copies, condition tree included. Null authors a fresh one.
Declaration
public UnityAchievementDefinition SourceToClone
Field Value
| Type | Description |
|---|---|
| UnityAchievementDefinition |
Remarks
Set by Duplicate(UnityAchievementDefinition, string, string, bool), and the only supported way to copy a condition tree: see Condition for why assigning the source's tree directly is not one.
SteamApiName
The Steamworks "API Name" the achievement is mirrored under. Blank means not mirrored.
Declaration
public string SteamApiName
Field Value
| Type | Description |
|---|---|
| string |
TargetFolder
Folder the achievement asset lands in. Created when it does not exist yet.
Declaration
public string TargetFolder
Field Value
| Type | Description |
|---|---|
| string |
XboxAchievementId
The Xbox achievement identifier. Blank means not mirrored.
Declaration
public string XboxAchievementId
Field Value
| Type | Description |
|---|---|
| string |
Properties
ResolvedTargetFolder
The folder this achievement lands in, trimmed — the one answer the validator's occupied-path rule and the creator's write step both ask for, so the rule that refuses a path and the step that writes to it cannot disagree about which path it is.
Declaration
public string ResolvedTargetFolder { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
ApplyTo(UnityAchievementDefinition)
Copies every authored field onto definition, leaving its Guid alone.
Declaration
public void ApplyTo(UnityAchievementDefinition definition)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityAchievementDefinition | definition | The asset to write to. |
Remarks
The Guid is the cross-type serialization key and belongs to the asset, not to what is authored into it: an update must keep the one the project already references, and a fresh asset (or a clone) gets a new one from its creation step.
Condition IS written, by reference. That is right for a fresh asset and for an
update, and wrong for a copy, which already carries a deep copy of its source's tree — so
BuildDefinitionAsset puts that copy back after calling this. Anything that applies an
Input to a clone has to do the same.
CaptureFrom(UnityAchievementDefinition)
Reads every authored field off an existing achievement, so a caller can edit or copy it through the same shape it would author a new one with.
Declaration
public static AchievementDefinitionCreator.Input CaptureFrom(UnityAchievementDefinition source)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityAchievementDefinition | source | The achievement to read. Must not be null. |
Returns
| Type | Description |
|---|---|
| AchievementDefinitionCreator.Input | An Input describing |
Remarks
TargetFolder comes from where the source actually lives, so an Input captured for an Update(UnityAchievementDefinition, Input) or a same-folder Duplicate(UnityAchievementDefinition, string, string, bool) resolves its Id collisions against the folder that matters rather than against the module's default one.
Every scalar here is a copy; Condition is NOT — it is the source's live tree. That
is what makes a captured Input safe to hand back to Update(UnityAchievementDefinition, Input) and what makes editing
its tree in place an edit of the source asset, so call BeginEdit(UnityAchievementDefinition, string) on
source before doing that.