Unlocks reference
The component that buys and keeps unlocks, and the unlock asset with its cost and prerequisites. For how to use it, see Unlocks.
VtUnitUnlocks
Component. Add it with Add Component → Vantage → Progression → VtUnitUnlocks.
What a unit has unlocked, and the way it buys more. Add it to a player to let it research or buy blueprints with TryUnlock.
Scripting API
| Member | Description |
|---|---|
IReadOnlyCollection<VtUnlockDefinition> Owned { get; } |
The unlocks this unit keeps for itself. Unlocks kept by its stash are not listed; use Has for the combined check. |
IVtCostSource CostSource { get; } |
The source unlocks are paid from: the override when one is set, the stash that serves the unit, or its own bag and wallet. |
event Action<VtUnlockDefinition> OnUnlocked |
Fires after an unlock was bought or granted, for this unit or its stash. |
event Action<VtUnlockDefinition, VtUnlockFailureReason> OnUnlockFailed |
Fires when a TryUnlock call is refused, with the reason. |
void Initialize() |
Cache siblings. Idempotent; public for the late-attach path. |
void SetCostSource(IVtCostSource source) |
Pay for unlocks from source and keep them on this unit. Null goes back to the default choice. |
static bool IsUnlocked(VtUnit unit, VtUnlockDefinition unlock) |
Whether unit owns unlock: kept by the unit itself or by a shared stash whose scope includes it, wherever the unit stands. A null unlock is always owned, so a buildable without one is never locked. |
bool Has(VtUnlockDefinition unlock) |
Whether this unit owns unlock, itself or through its stash. |
bool CanUnlock(VtUnlockDefinition unlock, out VtUnlockFailureReason reason) |
Every check TryUnlock runs, without paying. Pure query. |
bool TryUnlock(VtUnlockDefinition unlock, out VtUnlockFailureReason reason) |
Buy unlock: pay its cost from CostSource and keep it with whoever paid. On a predicting client the request is forwarded and this returns false with VtUnlockFailureReason.AuthorityNotLocal. |
bool Grant(VtUnlockDefinition unlock) |
Give this unit unlock for free, such as a quest reward. Kept on the unit, not its stash; use VtSharedStash.GrantUnlock for the team. Authority-gated. |
void ApplyUnlocksFromNet(IReadOnlyList<VtUnlockDefinition> snapshot) |
Replace the unit’s own unlocks with snapshot. Bypasses the authority gate: the replication and load path. Fires OnUnlocked for each one that is new. |
VtUnlockDefinition
Asset. Create it with Create → Vantage → Progression → Unlock.
Something bought once and kept for good: a research step, a blueprint, a tier of the tech tree. A buildable or recipe that names it in Required Unlock is refused until it is bought.
Inspector fields
General
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Id (id) |
string |
Empty | Stable string identifier for save files and network payloads. Convention: ‘unlock.. |
|
Display Name (displayName) |
string |
Empty | Name shown to the player. | |
Description (description) |
string |
Empty | Description shown in the tooltip. | |
Icon (icon) |
Sprite |
None | Icon for menus and tooltips. Optional. | |
Icon Id (iconId) |
string |
Empty | Name of an icon from the package’s icon set (VtIcons), used when Icon is empty. Optional. |
Cost
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Currency Cost (currencyCost) |
VtCurrencyAmount[] | Empty | Currency paid once on unlock, such as build points or research points. | |
Item Cost (itemCost) |
VtRecipeIngredient[] | Empty | Items paid once on unlock. |
Prerequisites
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Required Unlocks (requiredUnlocks) |
VtUnlockDefinition[] | Empty | Unlocks that must be owned first. | |
Required Level (requiredLevel) |
int |
0 | ≥ 0 | Minimum level of the unit buying it. 0 = no gate. |
Enums
VtUnlockFailureReason
Why VtUnitUnlocks.TryUnlock was refused.
| Value | Description |
|---|---|
None |
Nothing went wrong. |
UnlockNull |
No unlock was given. |
AlreadyUnlocked |
It is already owned. |
MissingPrerequisite |
One of its required unlocks is not owned yet. |
LevelTooLow |
The unit’s level is below the unlock’s required level. |
MissingItems |
The cost source lacks the items. |
MissingCurrency |
The cost source lacks the currency. |
AuthorityNotLocal |
This process is not the authority; the request was forwarded. |