Table of Contents

Class InteractionPromptBuilder

Namespace
S1API.Interaction
Assembly
S1API.dll

Builds a native Schedule One interaction prompt for a mod-owned GameObject.

public sealed class InteractionPromptBuilder
Inheritance
InteractionPromptBuilder
Inherited Members
Extension Methods

Remarks

The target must contain a collider on a layer included by the game's interaction search mask. The builder does not create colliders or change object layers.

Methods

Build()

Attaches the native interaction component and returns a managed runtime handle.

public InteractionPrompt Build()

Returns

InteractionPrompt

The managed interaction prompt handle.

Exceptions

InvalidOperationException

Thrown when the message is missing, the target already has an interaction component, or no usable collider exists beneath the target.

Create(GameObject)

Creates a builder for a mod-owned GameObject.

public static InteractionPromptBuilder Create(GameObject target)

Parameters

target GameObject

The GameObject whose collider should be interactable.

Returns

InteractionPromptBuilder

A new interaction prompt builder.

OnHovered(Action)

Registers a callback invoked while this prompt is selected.

public InteractionPromptBuilder OnHovered(Action callback)

Parameters

callback Action

The callback invoked by the native hover lifecycle.

Returns

InteractionPromptBuilder

This builder for fluent chaining.

OnInteractionEnded(Action)

Registers a callback invoked when the native interaction ends.

public InteractionPromptBuilder OnInteractionEnded(Action callback)

Parameters

callback Action

The callback invoked by the native interaction lifecycle.

Returns

InteractionPromptBuilder

This builder for fluent chaining.

OnInteractionStarted(Action)

Registers a callback invoked when the native interaction starts.

public InteractionPromptBuilder OnInteractionStarted(Action callback)

Parameters

callback Action

The callback invoked by the native interaction lifecycle.

Returns

InteractionPromptBuilder

This builder for fluent chaining.

WithAngleLimit(float)

Limits selection to the specified horizontal angle around the target's forward direction.

public InteractionPromptBuilder WithAngleLimit(float angleLimit)

Parameters

angleLimit float

A finite angle greater than zero and at most 180 degrees.

Returns

InteractionPromptBuilder

This builder for fluent chaining.

WithDisplayLocation(Collider)

Uses a collider's closest point to the player as the native prompt display anchor.

public InteractionPromptBuilder WithDisplayLocation(Collider displayCollider)

Parameters

displayCollider Collider

The collider used for display positioning.

Returns

InteractionPromptBuilder

This builder for fluent chaining.

WithDisplayLocation(Transform)

Uses a transform as the native prompt display anchor.

public InteractionPromptBuilder WithDisplayLocation(Transform displayPoint)

Parameters

displayPoint Transform

The transform whose position should be used.

Returns

InteractionPromptBuilder

This builder for fluent chaining.

WithInput(InteractionPromptInput)

Sets the native input action used to begin the interaction.

public InteractionPromptBuilder WithInput(InteractionPromptInput input)

Parameters

input InteractionPromptInput

The interaction input action.

Returns

InteractionPromptBuilder

This builder for fluent chaining.

WithMessage(string)

Sets the text rendered by the native interaction prompt.

public InteractionPromptBuilder WithMessage(string message)

Parameters

message string

Non-empty player-facing prompt text.

Returns

InteractionPromptBuilder

This builder for fluent chaining.

WithPriority(int)

Sets the priority used when native prompts overlap.

public InteractionPromptBuilder WithPriority(int priority)

Parameters

priority int

A higher value takes precedence.

Returns

InteractionPromptBuilder

This builder for fluent chaining.

WithRange(float)

Sets the maximum distance at which the prompt can be selected.

public InteractionPromptBuilder WithRange(float range)

Parameters

range float

A finite distance between zero and four metres.

Returns

InteractionPromptBuilder

This builder for fluent chaining.

WithState(InteractionPromptState)

Sets the native prompt state.

public InteractionPromptBuilder WithState(InteractionPromptState state)

Parameters

state InteractionPromptState

The visual and interaction state.

Returns

InteractionPromptBuilder

This builder for fluent chaining.

WithoutAngleLimit()

Clears any angle restriction.

public InteractionPromptBuilder WithoutAngleLimit()

Returns

InteractionPromptBuilder

This builder for fluent chaining.