Table of Contents

Class ProductPresentationProfileBuilder

Namespace
S1API.Products
Assembly
S1API.dll

Builds an immutable custom product presentation profile.

public sealed class ProductPresentationProfileBuilder
Inheritance
ProductPresentationProfileBuilder
Inherited Members
Extension Methods

Constructors

ProductPresentationProfileBuilder()

public ProductPresentationProfileBuilder()

Methods

Build()

Creates an immutable presentation profile snapshot.

public ProductPresentationProfile Build()

Returns

ProductPresentationProfile

The presentation profile.

Exceptions

InvalidOperationException

Thrown when a required context has no configured provider or loose-visual fallback.

Require(params ProductPresentationContext[])

Marks contexts as required. A missing provider, missing native scaffold, null result, or provider failure then produces a clear registration error instead of falling back.

public ProductPresentationProfileBuilder Require(params ProductPresentationContext[] contexts)

Parameters

contexts ProductPresentationContext[]

Defined presentation contexts to require.

Returns

ProductPresentationProfileBuilder

This builder.

Exceptions

ArgumentNullException

Thrown when contexts is null.

ArgumentOutOfRangeException

Thrown when a context is not a defined ProductPresentationContext value.

WithAvatarHeldTransform(ProductPresentationTransform)

Sets a third-person avatar-held transform while reusing the held visual provider.

public ProductPresentationProfileBuilder WithAvatarHeldTransform(ProductPresentationTransform presentationTransform)

Parameters

presentationTransform ProductPresentationTransform

The cloned avatar visual root transform.

Returns

ProductPresentationProfileBuilder

This builder.

Remarks

Use this when first- and third-person views share a model but need different poses.

WithAvatarHeldVisual(Func<GameObject?>)

Sets a third-person avatar-held visual provider independently of the first-person held visual.

public ProductPresentationProfileBuilder WithAvatarHeldVisual(Func<GameObject?> provider)

Parameters

provider Func<GameObject>

A provider that returns a mod-owned visual prefab source.

Returns

ProductPresentationProfileBuilder

This builder.

Remarks

When omitted, the avatar equippable continues to use the held visual provider and transform, preserving the existing presentation behavior.

WithAvatarHeldVisual(Func<GameObject?>, ProductPresentationTransform)

Sets a third-person avatar-held visual provider and transform independently of the first-person held visual.

public ProductPresentationProfileBuilder WithAvatarHeldVisual(Func<GameObject?> provider, ProductPresentationTransform presentationTransform)

Parameters

provider Func<GameObject>

A provider that returns a mod-owned visual prefab source.

presentationTransform ProductPresentationTransform

The cloned avatar visual root transform.

Returns

ProductPresentationProfileBuilder

This builder.

WithConsumptionPrefab(Func<GameObject?>)

Sets the consumption prefab provider.

public ProductPresentationProfileBuilder WithConsumptionPrefab(Func<GameObject?> provider)

Parameters

provider Func<GameObject>

A provider that returns a prefab source containing the game's ProductConsumeAnimation component.

Returns

ProductPresentationProfileBuilder

This builder.

Exceptions

ArgumentNullException

Thrown when provider is null.

WithFunctionalProductConvexMeshColliders()

Replaces inherited functional-product colliders with convex mesh colliders built from the configured functional visual.

public ProductPresentationProfileBuilder WithFunctionalProductConvexMeshColliders()

Returns

ProductPresentationProfileBuilder

This builder.

Remarks

Use this for compact or non-box-shaped loose products that participate in packaging-station physics. The default remains the native scaffold collider plus S1API's legacy box-collider fallback so existing mods retain their current collision behavior. A functional-product visual or loose-visual fallback must be configured before Build().

WithFunctionalProductVisual(Func<GameObject?>)

Sets the functional-product visual provider.

public ProductPresentationProfileBuilder WithFunctionalProductVisual(Func<GameObject?> provider)

Parameters

provider Func<GameObject>

A provider that returns a mod-owned visual prefab source.

Returns

ProductPresentationProfileBuilder

This builder.

WithFunctionalProductVisual(Func<GameObject?>, ProductPresentationTransform)

Sets the functional-product visual provider and an explicit local transform override.

public ProductPresentationProfileBuilder WithFunctionalProductVisual(Func<GameObject?> provider, ProductPresentationTransform presentationTransform)

Parameters

provider Func<GameObject>

A provider that returns a mod-owned visual prefab source.

presentationTransform ProductPresentationTransform

The cloned visual root transform.

Returns

ProductPresentationProfileBuilder

This builder.

WithGeneratedIconFromLooseVisual(int)

Generates the loose inventory icon from the loose visual through the game's item-icon rendering rig exposed by IconFactory.

public ProductPresentationProfileBuilder WithGeneratedIconFromLooseVisual(int size = 512)

Parameters

size int

The square icon size, from 32 through 2048 pixels.

Returns

ProductPresentationProfileBuilder

This builder.

Remarks

S1API keeps the representation template's icon while it queues capture. The queue waits for the native rig, yields through a complete render frame, rejects transparent cold-start captures, and finishes while the loading screen is still open.

Exceptions

ArgumentOutOfRangeException

Thrown when size is outside 32 through 2048.

WithGeneratedIconFromLooseVisual(int, bool, float)

Generates the loose inventory icon with explicit native-camera framing controls.

public ProductPresentationProfileBuilder WithGeneratedIconFromLooseVisual(int size, bool fitToCamera, float cameraFill = 0.72)

Parameters

size int

The square icon size, from 32 through 2048 pixels.

fitToCamera bool

Whether S1API should fit renderer bounds to the native fixed thumbnail camera. Set false to preserve the provider's authored scale.

cameraFill float

The target share of the native camera's vertical view when fitting, greater than zero through 2. Values above 1 intentionally crop the model.

Returns

ProductPresentationProfileBuilder

This builder.

Exceptions

ArgumentOutOfRangeException

Thrown when size is outside 32 through 2048 or cameraFill is not greater than zero through 2.

WithGeneratedIconTransform(ProductPresentationTransform)

Sets an icon-only transform for generated loose-visual icons.

public ProductPresentationProfileBuilder WithGeneratedIconTransform(ProductPresentationTransform presentationTransform)

Parameters

presentationTransform ProductPresentationTransform

The cloned visual root transform used only during icon capture.

Returns

ProductPresentationProfileBuilder

This builder.

Remarks

This replaces the loose presentation transform during icon capture without changing stored, held, station, or world presentation. It may be configured before or after WithGeneratedIconFromLooseVisual(int). It is not used when an explicit icon provider is selected with WithIcon(Func<Sprite?>).

Exceptions

ArgumentNullException

Thrown when presentationTransform is null.

WithHeldVisual(Func<GameObject?>)

Sets the first- and third-person held visual provider.

public ProductPresentationProfileBuilder WithHeldVisual(Func<GameObject?> provider)

Parameters

provider Func<GameObject>

A provider that returns a mod-owned visual prefab source.

Returns

ProductPresentationProfileBuilder

This builder.

WithHeldVisual(Func<GameObject?>, ProductPresentationTransform)

Sets the held visual provider and an explicit local transform override.

public ProductPresentationProfileBuilder WithHeldVisual(Func<GameObject?> provider, ProductPresentationTransform presentationTransform)

Parameters

provider Func<GameObject>

A provider that returns a mod-owned visual prefab source.

presentationTransform ProductPresentationTransform

The cloned visual root transform.

Returns

ProductPresentationProfileBuilder

This builder.

WithIcon(Func<Sprite?>)

Sets an explicit loose inventory icon provider.

public ProductPresentationProfileBuilder WithIcon(Func<Sprite?> provider)

Parameters

provider Func<Sprite>

A provider that returns a mod-owned sprite.

Returns

ProductPresentationProfileBuilder

This builder.

Exceptions

ArgumentNullException

Thrown when provider is null.

WithLooseVisual(Func<GameObject?>)

Sets the shared loose visual provider. Stored, held, station, and functional-product contexts use this provider when they do not define a context-specific visual.

public ProductPresentationProfileBuilder WithLooseVisual(Func<GameObject?> provider)

Parameters

provider Func<GameObject>

A provider that returns a mod-owned visual prefab source.

Returns

ProductPresentationProfileBuilder

This builder.

WithLooseVisual(Func<GameObject?>, ProductPresentationTransform)

Sets the shared loose visual provider and an explicit local transform override.

public ProductPresentationProfileBuilder WithLooseVisual(Func<GameObject?> provider, ProductPresentationTransform presentationTransform)

Parameters

provider Func<GameObject>

A provider that returns a mod-owned visual prefab source.

presentationTransform ProductPresentationTransform

The cloned visual root transform.

Returns

ProductPresentationProfileBuilder

This builder.

WithStationVisual(Func<GameObject?>)

Sets the station-item visual provider.

public ProductPresentationProfileBuilder WithStationVisual(Func<GameObject?> provider)

Parameters

provider Func<GameObject>

A provider that returns a mod-owned visual prefab source.

Returns

ProductPresentationProfileBuilder

This builder.

WithStationVisual(Func<GameObject?>, ProductPresentationTransform)

Sets the station-item visual provider and an explicit local transform override.

public ProductPresentationProfileBuilder WithStationVisual(Func<GameObject?> provider, ProductPresentationTransform presentationTransform)

Parameters

provider Func<GameObject>

A provider that returns a mod-owned visual prefab source.

presentationTransform ProductPresentationTransform

The cloned visual root transform.

Returns

ProductPresentationProfileBuilder

This builder.

WithStoredVisual(Func<GameObject?>)

Sets the stored-item visual provider.

public ProductPresentationProfileBuilder WithStoredVisual(Func<GameObject?> provider)

Parameters

provider Func<GameObject>

A provider that returns a mod-owned visual prefab source.

Returns

ProductPresentationProfileBuilder

This builder.

WithStoredVisual(Func<GameObject?>, ProductPresentationTransform)

Sets the stored-item visual provider and an explicit local transform override.

public ProductPresentationProfileBuilder WithStoredVisual(Func<GameObject?> provider, ProductPresentationTransform presentationTransform)

Parameters

provider Func<GameObject>

A provider that returns a mod-owned visual prefab source.

presentationTransform ProductPresentationTransform

The cloned visual root transform.

Returns

ProductPresentationProfileBuilder

This builder.