Version: 2017.2
public static bool AddInput (string name, string deviceName, string serverUrl, int index, ClusterInputType type);

参数

name 输入条目的名称。它必须是唯一的。
deviceName 向 VRPN 服务器注册的设备名称。
serverUrl VRPN 服务器的网址。
index 输入条目的索引,如果不确定,请参考 vrpn.cfg。
type 输入的类型。

返回

bool 如果操作成功,则为 true。

描述

添加一个新的 VRPN 输入条目。

这些参数与通过“Project Setting > Cluster Input”添加输入的方式相同。通过此方法添加的输入条目仅在应用程序会话的生命周期内有效。添加的条目不像通过“Project Setting > Cluster Input”添加的条目那样一直存在。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void AddNewClusterInputEntry() { // Add a new entry named "new_button_1". Which is a mouse connected to VRPN at localhost. ClusterInput.AddInput("new_button_1", "mouse_0", "localhost", 0, ClusterInputType.Button); } }

另请参阅:ClusterInput.EditInput