void Awake() { if (_instance == null) { //If I am the first instance, keep track of me _instance = this; //DontDestroyOnLoad(this); Debug.Log("Initialed"); } else { //If a Singleton already exists and you find another reference in scene, destroy it. if (this != _instance) { Debug.Log("ERROR!!!! You have more than one instance of the Motion Capture Streaming Receiver in your scene. There can be only one. Anything that happens from this point on may be weird."); //Destroy(this.gameObject); } } if (mocapServer == MocapServer.Cube_QualisysTrackManager) { QTMInterface = transform.Find("Qualisys_DoNotEdit").GetComponent <QTMInterface> (); QTMInterface.gameObject.SetActive(true); QTMInterface.Initialize(QTMserverIP, QTMserverPort, QTMlocalPort); } else if (mocapServer == MocapServer.Perform_OptitrackMotiveBody) { OMBInterface = transform.Find("Optitrack_DoNotEdit").GetComponent <OptitrackStreamingClient> (); OMBInterface.gameObject.SetActive(true); OMBInterface.Initialize(OMBlocalAddress, OMBserverAddress, OMBdataPort, OMBcommandPort); } }
// Use this for initialization void Start() { Debug.Log("mocapServer: " + mocapServer); OMBInterface = new OMBInterface(OMBmulticastIP, OMBhostIP, OMBdataPort, OMBcommandPort, OMBNatNetVersion); OMBInterface.Initialize(); QTMInterface = new QTMInterface(QTMserverIP, QTMserverPort, QTMlocalPort); QTMInterface.Initialize(); }