Class AchievementDetailGui
The Studio's detail pane: everything about the one selected achievement, edited in place — its identity, what the player sees, what it awards, where it is mirrored, what unlocks it, what is wrong with it, and a Play Mode unlock.
Inherited Members
Namespace: Serenity.Achievements.Infrastructure.Editor.Studio
Assembly: Serenity.UnityAchievements.Infrastructure.Editor.dll
Syntax
public sealed class AchievementDetailGui
Remarks
Every write goes through a UnityEditor.SerializedObject, which is what makes the pane undoable and
what makes it safe: the condition tree is a [SerializeReference] graph, and the shared drawer
writes it through serialized properties rather than by touching the live reference, so Unity records the
undo for both. A pane that assigned definition.Condition directly would have to call
BeginEdit(UnityAchievementDefinition, string) before the first mutation; this one never does that,
and says so here rather than leaving the next reader to check.
The condition, the findings and the Play Mode unlock are drawn by AchievementAuthoringSectionGui — the same collaborator the achievement's own inspector uses — so the two tools cannot drift into telling an author different things about the same asset. What is specific to this pane is the field layout above them and the rename below the Id.
Constructors
AchievementDetailGui()
Declaration
public AchievementDetailGui()
Fields
RenameButtonLabel
The button offered when the asset file name no longer matches the achievement's Id.
Declaration
public const string RenameButtonLabel = "Rename asset file to match Id"
Field Value
| Type | Description |
|---|---|
| string |
RenameHint
Why the asset file name is worth keeping in step with the Id.
Declaration
public const string RenameHint = "This achievement's asset file no longer carries its Id. Nothing breaks — the module loads achievements by label, not by file name — but a folder whose file names match their Ids is the only way to find one without opening it."
Field Value
| Type | Description |
|---|---|
| string |
Properties
Definition
Declaration
public UnityAchievementDefinition Definition { get; }
Property Value
| Type | Description |
|---|---|
| UnityAchievementDefinition | The achievement currently shown, or null when nothing is selected. |
Methods
Bind(UnityAchievementDefinition)
Points the pane at another achievement, or at none.
Declaration
public void Bind(UnityAchievementDefinition definition)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityAchievementDefinition | definition | The achievement to show. May be null. |
Remarks
Rebinding is skipped when the same achievement is handed in again, so a repaint does not throw away the serialized object the author is mid-edit in.
Draw(IReadOnlyCollection<AchievementPlatformKind>)
Draws the pane and reports whether the achievement changed.
Declaration
public bool Draw(IReadOnlyCollection<AchievementPlatformKind> enabledPlatforms)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyCollection<AchievementPlatformKind> | enabledPlatforms | The storefronts the project ships on, resolved once by the window. |
Returns
| Type | Description |
|---|---|
| bool | True when something was written, so the list can be rebuilt. |
MarkStale()
Declares the findings out of date, so the next draw re-runs the project-wide rules.
Declaration
public void MarkStale()
UnlockSelected()
Fires the shown achievement's unlock. Public so the window's toolbar can fire the same unlock without the author scrolling the pane down to find its preview row.
Declaration
public void UnlockSelected()