public class NewInputSync : Synchronizableusing UnityEngine;
using Alteruna.Multiplayer;
[RequireComponent(typeof(NewInputSync))]
public class NewInputSyncTest : MonoBehaviour
{
public float MoveSpeed = 5f;
private NewInputSync _inputSync;
// Type specific action
private NewInputSync.InputActionSync.Action<float> _horizontal;
// Unspecified type action
private NewInputSync.InputActionSync _vertical;
private void Start()
{
var inputSync = GetComponent<NewInputSync>();
// Get casted action
_horizontal = inputSync.FindAction<float>("Horizontal");
// Get unspecified type action
_vertical = inputSync.FindAction("Vertical");
}
private void Update()
{
transform.Translate(
// Get value directly from the action
_horizontal.GetValue() * MoveSpeed * Time.deltaTime,
// Attempt to get value from the unspecified type action as float
_vertical.GetValue<float>() * MoveSpeed * Time.deltaTime,
0
);
}
}| AssembleData | (Overrides SynchronizableAssembleData(Writer, SerializeInfo)) |
| DisassembleData | (Overrides SynchronizableDisassembleData(Reader, UnserializeInfo)) |
| FindAction(Guid) | Retrieves an input action synchronization object corresponding to the specified unique identifier. |
| FindAction(String) | Finds an input action synchronization object by its name or identifier string. |
| FindActionT(String) | Finds the synchronized input action associated with the specified name or identifier string and casts it to the specified type. |
| FindActionId | Finds the unique identifier of an input action by its name or identifier string. |
| Possessed | (Overrides CommunicationBridgePossessed(Boolean, User)) |
| Start | |
| Unpossessed | (Overrides CommunicationBridgeUnpossessed) |