Skip to main content

TSMPSetup

TSMPSetup configures a scene so encoder, decoder, codec handlers, bindings, render textures, and materials agree with each other.

Most users interact with it through the inspector. Scripts and editor tools can call its public methods to refresh the same configuration.

Main references

FieldPurpose
encoderTSMPEncoder to configure.
decoderTSMPDecoder to configure.
sourceTextureTexture used by the sender side when needed.
decoderSourceTextureTexture read by the decoder.
preferEncoderOutputAsDecoderSourceUses encoder output as decoder source for loopback tests.
encoderOutputOutput render texture assigned to the encoder.
payloadByteTextureByte texture assigned to the decoder.

Frame settings

FieldPurpose
width / heightFallback frame size when no texture provides one.
blockSizePixel block size used by compatible codecs.
sampleSizeHeader/decode sample size.
flipYDecoder-side image flip.

When output and source textures are assigned, TSMPSetup can derive sizes from those textures instead of requiring repeated manual fields.

Codec discovery

FieldPurpose
autoDiscoverCodecsFinds installed codec catalogs and prefab entries.
codecPrefabsCodec prefabs available to the scene.
selectedCodecIndexSelected codec entry.
codecInstanceRootParent object for codec instances.

The Codec tab can show package metadata such as package name, author, and description when the codec package exposes a catalog.

Render texture setup

FieldPurpose
resizeFrameRenderTexturesResizes frame textures to match setup dimensions.
resizeByteRenderTexturesResizes byte textures for decoder readback.
autoSizeByteTextureComputes the byte texture size from payload capacity.
roundByteTextureWidthToPowerOfTwoMakes byte texture width power-of-two friendly.
byteTextureSafetyPixelsAdds extra pixels to avoid edge overflow.

ApplyNow()

public void ApplyNow()

Applies all setup options immediately. It refreshes codec instances, assigns encoder/decoder references, rebuilds network bindings, updates textures, and writes codec configuration.

Run it after:

  • Adding or removing TSMPNetworkBehaviour components.
  • Changing a network ID.
  • Changing codec selection.
  • Changing output or source textures.
  • Changing package imports.

EncodeEncoderNow()

public void EncodeEncoderNow()

Calls EncodeNow() on the configured encoder. This is mainly a debug action for editor-time frame preview.

RefreshInstalledCodecs()

public void RefreshInstalledCodecs()

Scans installed codec catalogs and updates the codec list. Use it after importing or removing codec packages.

Setup prefab

For a normal scene, start from:

Packages/com.kibalab.tsmp.core/Samples/TSMPController.prefab

Place the prefab, assign the textures for your transport path, select a codec, then run Apply Setup.