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:
CustomPayloadcan be used to pass non-core, handler-specific data (for example, precomputed configuration, references to non-core systems, or editor tools).
Properties
| Property | Type | Description |
|---|---|---|
| Player | Player | Logical representation of the user (ID, network info, etc.). |
| PlayerManager | PlayerManager | Component responsible for managing the player GameObject and its sub-objects (avatar, cameras, etc.). |
| IsLocalPlayer | bool | true if this player is controlled locally; false if it is a remote client. |
| IsPreview | bool | true if the representation is being set up in preview mode (e.g. lobby preview). |
| IsProducer | bool | true if the user is sending capture data (camera, HoloCapturer, etc.). |
| IsConsumer | bool | true if the user is only consuming/receiving data. |
| UserSourceType | BasePipeline.SourceType | Indicates the type of data source used for this representation (webcam, Holocapturer, etc.). |
| CustomPayload | object | Optional 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.
}
}