/// <summary>
        /// Gets the internal NatNet client instance singelton.
        /// When creating the singleton for the first time,
        /// tries to connect to a local MoCap server, and if not successful, a remote MoCap server.
        /// </summary>
        ///
        private void CreateManager()
        {
            configuration.LoadConfiguration();

            sceneListeners = new List <SceneListener>();

            clientMutex.WaitOne();
            if (client == null)
            {
                // only connect when this script is actually enabled
                if (this.isActiveAndEnabled)
                {
                    // construct client name
                    ReplaceSpecialApplicationNameParts();

                    // build list of data sources
                    ICollection <IMoCapClient_ConnectionInfo> sources = GetSourceList();

                    // run through the list
                    foreach (IMoCapClient_ConnectionInfo info in sources)
                    {
                        // construct client according to structure (this is ugly...)
                        if (info is NatNetClient.ConnectionInfo)
                        {
                            // is client already the right type?
                            if (!(client is NatNetClient))
                            {
                                client = new NatNetClient(ClientName, clientAppVersion);
                            }
                        }
                        else if (info is FileClient.ConnectionInfo)
                        {
                            // is client already the right type?
                            if (!(client is FileClient))
                            {
                                client = new FileClient();
                            }
                        }

                        if (client.Connect(info))
                        {
                            // connection established > that's it
                            break;
                        }
                    }

                    // no client yet > try OpenVR
                    if (((client == null) || !client.IsConnected()) && UnityEngine.XR.XRDevice.isPresent)
                    {
                        client = new OpenVR_Client();
                        client.Connect(null);

                        // did OpenVR work? If not, try he more generic Unity XR client
                        if (!client.IsConnected())
                        {
                            client = new UnityXR_Client();
                            client.Connect(null);
                        }
                    }

                    if ((client != null) && client.IsConnected())
                    {
                        Debug.Log("MoCap client connected to " + client.GetDataSourceName() + ".\n" +
                                  "Framerate: " + client.GetFramerate() + " fps");

                        // print list of actor and device names
                        Scene scene = client.GetScene();
                        if (scene.actors.Count > 0)
                        {
                            string actorNames = "";
                            foreach (Actor a in scene.actors)
                            {
                                if (actorNames.Length > 0)
                                {
                                    actorNames += ", ";
                                }
                                actorNames += a.name;
                            }
                            Debug.Log("Actors (" + scene.actors.Count + "): " + actorNames);
                        }
                        if (scene.devices.Count > 0)
                        {
                            string deviceNames = "";
                            foreach (Device d in scene.devices)
                            {
                                if (deviceNames.Length > 0)
                                {
                                    deviceNames += ", ";
                                }
                                deviceNames += d.name;
                            }
                            Debug.Log("Devices (" + scene.devices.Count + "): " + deviceNames);
                        }
                    }
                }

                if ((client == null) || !client.IsConnected())
                {
                    // not active or not able to connect to any data source: create dummy singleton
                    client = new DummyClient();
                }

                // all fine, notify listeners of scene change
                if ((client != null) && client.IsConnected())
                {
                    NotifyListeners_Change(Scene);
                }
            }
            clientMutex.ReleaseMutex();
        }
		/// <summary>
		/// Gets the internal NatNet client instance singelton.
		/// When creating the singleton for the first time, 
		/// tries to connect to a local MoCap server, and if not successful, a remote MoCap server.
		/// </summary>
		/// 
		private void CreateManager()
		{
			clientMutex.WaitOne();
			if (client == null)
			{
				// only connect when this script is actually enabled
				if (this.isActiveAndEnabled)
				{
					// build list of data sources
					ICollection<IMoCapClient_ConnectionInfo> sources = GetSourceList();

					// run through the list
					foreach (IMoCapClient_ConnectionInfo info in sources)
					{
						// construct client according to structure (this is ugly...)
						if (info is NatNetClient.ConnectionInfo)
						{
							// is client already the right type?
							if (!(client is NatNetClient))
							{
								string appName = SceneManager.GetActiveScene().name;
								client = new NatNetClient(appName, clientAppVersion);
							}
						}
						else if (info is FileClient.ConnectionInfo) 
						{
							// is client already the right type?
							if (!(client is FileClient))
							{
								client = new FileClient();
							}
						}

						if (client.Connect(info))
						{
							// connection established > that's it
							break;
						}
					}

					// no client yet > try VR
					if (!client.IsConnected() && UnityEngine.VR.VRDevice.isPresent)
					{
						client = new HtcViveClient();
						client.Connect(null);
					}

					if (client.IsConnected())
					{
						Debug.Log("MoCap client connected to " + client.GetDataSourceName() + ".");
					}
				}

				if ((client == null) || !client.IsConnected())
				{
					// not active or not able to connect to any data source: create dummy singleton 
					client = new DummyClient();
				}

			}
			clientMutex.ReleaseMutex();
		}