Class InputSender
The InputSender component is responsible for sending input data over a data channel in a Unity Render Streaming context.
Implements
Inherited Members
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Namespace: Unity.RenderStreaming
Assembly: Unity.RenderStreaming.dll
Syntax
[AddComponentMenu("Render Streaming/Input Sender")]
public class InputSender : DataChannelBase, IDataChannel
Methods
CalculateInputResion(Rect, Vector2Int)
Calculates the input region based on the given texture size and region in world coordinates.
Declaration
public void CalculateInputResion(Rect region, Vector2Int size)
Parameters
Type | Name | Description |
---|---|---|
Rect | region | The region of the texture in world coordinate system. |
Vector2Int | size | The size of the texture. |
Examples
var (region, size) = remoteVideoImage.GetRegionAndSize();
inputSender.CalculateInputResion(region, size);
See Also
Dispose()
Declaration
protected void Dispose()
See Also
EnableInputPositionCorrection(bool)
Enables or disables input position correction.
Declaration
public void EnableInputPositionCorrection(bool enabled)
Parameters
Type | Name | Description |
---|---|---|
bool | enabled | True to enable input position correction, false to disable. |
Examples
inputSender.EnableInputPositionCorrection(true);
See Also
OnDestroy()
Declaration
protected virtual void OnDestroy()
See Also
SetChannel(string, RTCDataChannel)
Sets the RTCDataChannel for the sender.
Declaration
public override void SetChannel(string connectionId, RTCDataChannel channel)
Parameters
Type | Name | Description |
---|---|---|
string | connectionId | The connection ID. |
RTCDataChannel | channel | The RTCDataChannel to set. |
Overrides
Examples
public void OnAddChannel(SignalingEventData data)
{
var obj = dictObj[data.connectionId];
var channels = obj.GetComponentsInChildren<IDataChannel>();
var channel = channels.FirstOrDefault(_ => !_.IsLocal && !_.IsConnected);
channel?.SetChannel(data);
}