API Reference
This page provides an overview of the core components, interfaces, and settings that make up the Decorating Toolkit.
Components
PlayerDecoratingController
The central hub for managing decorating interactions. It handles input via a pointer source, performs raycasting to find objects and surfaces, and manages the active drag session.
- Key Methods: TryStartDrag(), StopDrag().
- Key Properties: IsDragging.
RigidbodyPlaceable
Add this component to any GameObject with a Rigidbody to make it interactive. It tells the controller that this object can be picked up and moved.
Core Interfaces
IDragMotor
Defines how an object moves while being dragged.
- Begin(DragSession session): Called when the drag starts.
- Tick(DragSession session, float deltaTime): Called every physics update to update the object's position.
- End(DragSession session, bool committed): Called when the drag stops.
IPlaceable
The interface implemented by objects that can be picked up and placed. RigidbodyPlaceable is the default implementation.
IPlacementValidator
Defines rules for whether an object can be placed at its current position.
- Validate(DragSession session): Returns a PlacementValidationResult indicating if the current position is valid.
IInteractable
A general interface for objects that can be interacted with (e.g., clicked or hovered).
IPointerSource
Provides the controller with the user's pointer information (e.g., screen position or world ray).
- TryGetPointer(out PointerState pointerState): Returns true if a valid pointer state is available.
IInteractionRaycaster
Handles the logic for finding objects under the pointer.
Data Structures
DragSession
Contains the state of the current drag operation.
- Actor: The GameObject performing the drag (usually the player).
- Target: The IPlaceable being dragged.
- TargetPosition: The desired position for the object (calculated by motors).
- IsPlacementValid: Updated by validators to reflect whether the current position is legal.
Settings & Profiles (ScriptableObjects)
DecoratingToolkitSettings
The main configuration asset that links together your profiles and general settings (like layer masks).
GridSettings
Defines the grid size and which axes should snap when using grid dragging.
PhysicsDragProfile
Configures how the physics motor behaves, such as how much force is applied to move objects.
PlacementValidationProfile
Defines which layers are considered "blocking" for placement and other validation rules.
InteractableProfile
General settings for interactive objects, such as hover highlight colors or distance limits.