private void Update() { if (anchorManager == null) { anchorManager = UNetAnchorManager.Instance; } bool dirty = false; NetworkDiscoveryObject = GameObject.Find("UNETSharingStage").GetComponent <NetworkDiscoveryWithAnchors>(); if (NetworkDiscoveryObject == null) { return; } if (wasClient != NetworkDiscoveryObject.isClient) { Debug.Log("Was client changed to " + NetworkDiscoveryObject.isClient); wasClient = NetworkDiscoveryObject.isClient; dirty = true; } if (wasServer != NetworkDiscoveryObject.isServer) { wasServer = NetworkDiscoveryObject.isServer; dirty = true; } if (ServerIp != NetworkDiscoveryObject.ServerIp) { ServerIp = NetworkDiscoveryObject.ServerIp; dirty = true; } // Anchor manger doesn't come online until we connect if (anchorManager != null) { if (anchorEstablished != anchorManager.AnchorEstablished) { anchorEstablished = anchorManager.AnchorEstablished; dirty = true; } if (anchorName != anchorManager.AnchorName) { anchorName = anchorManager.AnchorName; dirty = true; } if (wasImporting != anchorManager.ImportInProgress) { wasImporting = anchorManager.ImportInProgress; dirty = true; } if (wasDownloading != anchorManager.DownloadingAnchor) { wasDownloading = anchorManager.DownloadingAnchor; dirty = true; } } if (dirty) { UpdateText(); } }
private void Start() { textMesh = GetComponent <TextMesh>(); anchorManager = UNetAnchorManager.Instance; UpdateText(); }