Skip to content

Class

SpendByIdRule

Generated GDScript class reference for GridPlacement.SpendByIdRule.

Status
Current
Version
v6.3.0
Source updated
2026-10-29
Generated on
2026-10-29

6.3. These pages document the 6.3 release, where placeable is now entry (what changed) and PlacementOwner is deprecated (migration). Still on 6.2? Your version's guides ship inside the plugin itself, under addons/grid_placement/guides/; the 6.2 URLs on this site now redirect to this series.

Spends a cost from a provider you pass in from code. Use this when your code creates the rule. To find the provider in the scene tree instead, use SpendMaterialsRuleById. The provider is any object with these methods:
get_count_by_id(id: StringName) -> int
try_remove_by_id(id: StringName, amount: int) -> int
try_add_by_id(id: StringName, amount: int) -> int var provider := MyGameProvider.new() var rule := SpendByIdRule.new({&"Gold": 100}, provider)

Source: addons/grid_placement/placement/placement_rules/template_rules/spend_by_id_rule.gd

Syntax

class SpendByIdRule extends SpendCostRuleBase