Texture streaming
Principle
This addon shows how to share images data with Runner.SendReliableDataToPlayer:
- either at the creation of an image: the image is sent to all connected users
- or upon the connection of a user joining the session late: the image is sent to this user only.
A StreamTextureManager must be included in the scene, ideally under the NetworkRunner hierarchy (otherwise, its runner attribute has to be defined).
To send an image, use `StreamTextureManager.SendTexture(textureReceiver, textureData, allPlayers), with:
textureReceiver: a component implementingIStreamTextureReceiver, implementingObjectto be able to find a network object to which forward the data when they are received, andReceiveTexture(Texture2D texture)through which the actual texture is receivedtexture: can be either aRenderTexture, aTexture2D, or a byte arrayplayers: a list of players to which send the data
Demo
To illustrate the usage, the CameraPicture component can receive locally an image (from a PhotoRecorder component), and will then forward it to all connected users.
If a user joins late, the state authority will forward the image data to this user only. A check in the FixedUpdateNetwork ensures that there is always a state authority (if the original author leaves).
Usage
The demo scene can be found in Assets\Photon\FusionAddons\TextureStreaming\Demo\Scenes\PhotoCamera.unity.
To shoot a picture, select the PhotoRecorder, once connected, and click on the Shoot picture button in the inspector, on the PhotoRecorder component.
Download
This addon latest version is included into the addon project
Supported topologies
- shared mode
Changelog
- Version 1.0.1: Fix demo scene + add namespace
- Version 1.0.0: First release