Class RemotePlayableConfiguration

Namespace: AppManaPublic.Configuration

Configures a streamable player in your game.

public class RemotePlayableConfiguration : UIBehaviour, IEvalInPage

Inheritance

UIBehaviour ← RemotePlayableConfiguration

Implements

IEvalInPage

Remarks

Connect the player's corresponding Camera (usually the main camera) to the Camera slot. This is the minimum amount of configuration needed for a working streamed player.

Use to start your experience. Start will be called potentially long before the player actually connects. This is an important part of ensuring AppMana streams load instantly.

If your game has UGUI-based UI, add the canvas scalers to this component in order to correctly set their scaling based on devices. You should use CanvasScaler.ScaleMode.ConstantPixelSize to emulate responsive web browser scaling.

If you're not sure where to put this component, add it to the root of the hierarchy that represents a single player. For example, this component should be the parent of the hierarchy that contains the main camera and canvas UI for the player.

Each player in a multiplayer game should have an active game object in the scene with this component attached to it. This means you should create a prefab with the player's camera and canvases with this component attached to the root of the prefab hierarchy, then create two or more references to it in your scene for multiplayer. You can visualize the different players by setting a distinct Display for each player's camera, and opening multiple game views visualizing each display. AppMana will automatically emulate the input for each player.

AppMana uses Input System to make multiplayer work. You must drag and drop an Input Action Asset into this component to correctly configure inputs. You can use the one that ships with the plugin. Find it in the Packages/ directory in your project view. You cannot use the Input class. Internally, AppMana duplicates the asset for each player and bind-masks (filters) inputs for the player's corresponding devices to the actions on this component's input action asset's action maps. In other words, use the property to access the action to listen to by name. Unfortunately, you cannot use the generated code file, because Unity does not configure it correctly for any kind of multiplayer scenario (local multiplayer nor AppMana multiplayer).

Properties

actions

This player's instance of the input actions asset.

public InputActionAsset actions { get; }

Property Value

InputActionAsset

camera

public Camera camera { get; set; }

Property Value

Camera

offlineUrlParameters

Set the URL parameters when this project is offline, for example when running in the editor.

public IReadOnlyDictionary<string, string> offlineUrlParameters { get; set; }

Property Value

IReadOnlyDictionary<string, string>

onPlayerConnected

Raised when the player connects for the first time.

public UnityEvent onPlayerConnected { get; }

Property Value

UnityEvent

onPlayerDisconnected

Raised when this player disconnects.

public UnityEvent onPlayerDisconnected { get; }

Property Value

UnityEvent

playerPrefs

public RemotePlayerPrefs playerPrefs { get; }

Property Value

RemotePlayerPrefs

urlParameters

public UrlParameters urlParameters { get; }

Property Value

UrlParameters

Methods

Awake()

protected override sealed void Awake()

AwakeImpl()

protected virtual void AwakeImpl()

DefaultMultipleSceneMitigations()

Override this method to change the default multiple scene mitigations when you choose to enable them but want to specify different ones for your use case.

protected virtual void DefaultMultipleSceneMitigations()

EvalInPage<T>(string, Func<T>, float)

Evaluates the provided JavaScript code in the context of the user's page.

public UniTask<T> EvalInPage<T>(string javascript, Func<T> editorStubResponse = null, float editorDelaySeconds = 0.2)

Parameters

javascript string

The code to execute. This will be awaited.

editorStubResponse Func<T>

When running in editor, return this stub instead.

editorDelaySeconds float

When running in editor, delay the reply by this amount of time.

Returns

UniTask<T>

The JSON response, deserialized.

Type Parameters

T

The expected type of the response. It should be JSON serializable. Use JToken to interpret as a general JSON value.

EvalInPage(string, Action)

Evaluates the provided JavaScript code in the context of the user's page.

public void EvalInPage(string javascript, Action editorStub = null)

Parameters

javascript string

editorStub Action

OnDisable()

protected override sealed void OnDisable()

OnDisableImpl()

protected virtual void OnDisableImpl()

OnEnable()

protected override sealed void OnEnable()

OnEnableImpl()

protected virtual void OnEnableImpl()

OnPlayerDisconnected()

public UniTask OnPlayerDisconnected()

Returns

UniTask

Start()

protected override sealed void Start()

StartImpl()

protected virtual void StartImpl()