void Start() { players = new List <Player> (); Debug.Log("Initializing Coda system"); if (CodaRTNetClient.InitSystem()) { if (CodaRTNetClient.StartAcquiring()) { Debug.Log("StartAcq success"); uint numMarkers = CodaRTNetClient.getMaxMarkers(); for (uint i = 0; i < numMarkers; i++) { var player = GameObject.Instantiate(_playerPrefab); player.SetMarkerID(i + 1); } started = true; if (updateInvokeRepeating) { InvokeRepeating("CodaFrameUpdate", 1.0f, 0.001f); } } } }
void OnDisable() { if (started) { CodaRTNetClient.StopAcquiring(); CodaRTNetClient.StopSystem(); Debug.Log("Client Closed"); started = false; } }
void CodaFrameUpdate() { if (started && updateInvokeRepeating) { var markerFrame = CodaRTNetClient.GetLatestFrame(); if (markerFrame != null) { this.markerFrame = markerFrame; } } }