Table of Contents

Class ContentBuilder

Namespace
MonoGame.Framework.Content.Pipeline.Builder
Assembly
MonoGame.Framework.Content.Pipeline.dll

This class is the entry point for the content builder system.

public abstract class ContentBuilder
Inheritance
ContentBuilder
Inherited Members

Properties

ContentCache

Gets or sets the content cahcing system to be used by the ContentBuilder.

public virtual IContentCache ContentCache { get; init; }

Property Value

IContentCache

FailedToBuild

Returns the number of content items that failed to build.

public uint FailedToBuild { get; }

Property Value

uint

Logger

Gets or sets the logger to be used by the ContentBuilder.

public ContentBuildLogger Logger { get; set; }

Property Value

ContentBuildLogger

ContentBuildLogger by default.

Parameters

Parameters to be used by the ContentBuilder or any of its subsystems.

Can be passed from CLI args, see Run(string[]).

public ContentBuilderParams Parameters { get; set; }

Property Value

ContentBuilderParams

SucceededToBuild

Returns the number of content items that built successfully.

public uint SucceededToBuild { get; }

Property Value

uint

Methods

BuildAndLoadContent(string, ContentInfo)

Initiates a build of the specified asset and then loads the result into memory.

public (ContentFileCache? contentFileCache, object? processedObject) BuildAndLoadContent(string relativePath, ContentInfo contentInfo)

Parameters

relativePath string

A relative path to the source asset.

contentInfo ContentInfo

The desired ContentInfo to be used for the content building.

Returns

(ContentFileCache contentFileCache, object processedObject)

BuildAndWriteContent(string, ContentInfo)

Initiates a build of the specified asset and then writes down the result to disk..

public ContentFileCache? BuildAndWriteContent(string relativePath, ContentInfo contentInfo)

Parameters

relativePath string

A relative path to the source asset.

contentInfo ContentInfo

The desired ContentInfo to be used for the content building.

Returns

ContentFileCache

GetContentCollection()

Called to build system to gather information about how to handle the content. It gets called only once during initialization.

public abstract IContentCollection GetContentCollection()

Returns

IContentCollection

An IContentCollection that contains information about the content handling.

Run(ContentBuilderParams)

Runs the ContentBuilder with the specified parameters.

public bool Run(ContentBuilderParams parameters)

Parameters

parameters ContentBuilderParams

A ContentBuilderParams describing both the platform paramteres for the content compilation as well as the configuration of the ContentBuilder itself.

Returns

bool

Run(string[])

A helper method to run the ContentBuilder with the passed ContentBuilderParams from the entry point args.

public void Run(string[] args)

Parameters

args string[]

An array of string to be deserialized into ContentBuilderParams.