private GlobalState() { // Initialize the zView context. PluginError error = zvuInitialize(NodeType.Presenter, out _context); if (error == PluginError.Ok) { // Set the context's node name. error = zvuSetNodeName(_context, ZView.StringToNativeUtf8(this.GetProjectName())); if (error != PluginError.Ok) { Debug.LogError(string.Format("Failed to set node name: ({0})", error)); } // Set the context's node status. error = zvuSetNodeStatus(_context, ZView.StringToNativeUtf8(string.Empty)); if (error != PluginError.Ok) { Debug.LogError(string.Format("Failed to set node status: ({0})", error)); } // Get both standard and augmented reality modes. List <ZVSupportedMode> supportedModes = new List <ZVSupportedMode>(); _modeStandard = this.GetMode(_context, CompositingMode.None, CameraMode.LocalHeadTracked); if (_modeStandard != IntPtr.Zero) { supportedModes.Add( new ZVSupportedMode { mode = _modeStandard, modeAvailability = ModeAvailability.Available }); } _modeAugmentedReality = this.GetMode(_context, CompositingMode.AugmentedRealityCamera, CameraMode.RemoteMovable); if (_modeAugmentedReality != IntPtr.Zero) { supportedModes.Add( new ZVSupportedMode { mode = _modeAugmentedReality, modeAvailability = ModeAvailability.Available }); } // Set the context's supported modes. error = zvuSetSupportedModes(_context, supportedModes.ToArray(), supportedModes.Count); if (error != PluginError.Ok) { Debug.LogError(string.Format("Failed to set supported modes: ({0})", error)); } // Set the context's supported capabilities. error = zvuSetSupportedCapabilities(_context, null, 0); if (error != PluginError.Ok) { Debug.LogError(string.Format("Failed to set supported capabilities: ({0})", error)); } // Start listening for new connections. error = zvuStartListeningForConnections(_context, ZView.StringToNativeUtf8(string.Empty)); if (error != PluginError.Ok) { Debug.LogError(string.Format("Failed to start listening for connections: ({0})", error)); } _isInitialized = true; } else { Debug.LogWarning(string.Format("Failed to initialize zView context: ({0})", error)); _isInitialized = false; } }