Skip to main content

RepresentationSetupContext

Namespace: Holo.Core
Assembly: Holo.Core

Description

RepresentationSetupContext is a data container passed into IUserRepresentationHandler.Setup().
It gives the handler all relevant information about the player, their role and the active pipeline/source.

Syntax

public class RepresentationSetupContext
{
public Player Player { get; set; }
public PlayerManager PlayerManager { get; set; }
public bool IsLocalPlayer { get; set; }
public bool IsPreview { get; set; }
public bool IsProducer { get; set; }
public bool IsConsumer { get; set; }
public BasePipeline.SourceType UserSourceType { get; set; }
public object CustomPayload { get; set; }
}

NOTE: CustomPayload can be used to pass non-core, handler-specific data (for example, precomputed configuration, references to non-core systems, or editor tools).

Properties

PropertyTypeDescription
PlayerPlayerLogical representation of the user (ID, network info, etc.).
PlayerManagerPlayerManagerComponent responsible for managing the player GameObject and its sub-objects (avatar, cameras, etc.).
IsLocalPlayerbooltrue if this player is controlled locally; false if it is a remote client.
IsPreviewbooltrue if the representation is being set up in preview mode (e.g. lobby preview).
IsProducerbooltrue if the user is sending capture data (camera, HoloCapturer, etc.).
IsConsumerbooltrue if the user is only consuming/receiving data.
UserSourceTypeBasePipeline.SourceTypeIndicates the type of data source used for this representation (webcam, Holocapturer, etc.).
CustomPayloadobjectOptional extra data passed in by the caller for advanced/extensible scenarios.

Example

var _context = new RepresentationSetupContext
{
Player = _player,
PlayerManager = _playerManager,
IsLocalPlayer = _isLocalPlayer,
IsPreview = _isInLobbyPreview,
IsProducer = _isProducer,
IsConsumer = _isConsumer,
UserSourceType = _selectedSourceType,
CustomPayload = _customPayload
};

_handler.Setup(_context);

Inside your handler, you can branch based on these flags:

public void Setup(RepresentationSetupContext _context)
{
if (_context.IsLocalPlayer && _context.IsProducer)
{
// Attach local capture pipeline, enable local cameras, etc.
}
else if (!_context.IsLocalPlayer && _context.IsConsumer)
{
// Configure remote-only visualization.
}

if (_context.IsPreview)
{
// Optional: reduce quality or use placeholder assets.
}
}

See Also: