Inheritance: UnityEngine.MonoBehaviour
        void _CreateSender()
        {
            if (texture == null)
            {
                return;
            }
            if (!Spout.isInit)
            {
                return;
            }
            if (!Spout.instance.enabled)
            {
                return;
            }

            if (!senderIsCreated)
            {
                Spout.Log("Sender is not created, creating one");
                senderIsCreated = Spout.instance.CreateSender(sharingName, texture, (int)textureFormat);
            }

            _attempts++;
            if (_attempts > CREATE_ATTEMPTS)
            {
                Debug.LogWarning(String.Format("There are problems with creating the sender {0}. Please check your settings or restart Unity.", sharingName));
            }

            Spout.instance.OnSenderStopped -= OnSenderStoppedDelegate;
            Spout.instance.OnSenderStopped += OnSenderStoppedDelegate;

            Spout.instance.OnAllSendersStopped -= OnAllSendersStoppedDelegate;
            Spout.instance.OnAllSendersStopped += OnAllSendersStoppedDelegate;
        }
示例#2
0
        void OnDestroy()
        {
            //Debug.Log("Spout.OnDestroy");
            if (_instance != this)
            {
                return;
            }

            if (_isInit)
            {
                _CleanUpResources();
            }

            isReceiving        = false;
            _isInit            = false;
            newSenders         = null;
            stoppedSenders     = null;
            activeSenders      = null;
            activeLocalSenders = null;
            localSenderNames   = null;

            OnEnabled       = null;
            OnSenderStopped = null;

            _instance = null;


            GC.Collect();            //??
        }
示例#3
0
 private void _CloseSender()
 {
     Debug.Log("SpoutSender._CloseSender:" + sharingName);
     if (senderIsCreated)
     {
         Spout.CloseSender(sharingName);
     }
     _CloseSenderCleanUpData();
 }
示例#4
0
        void OnDisable()
        {
            //Debug.Log("SpoutReceiver.OnDisable");
                        #if UNITY_EDITOR
            UnityEditor.EditorApplication.update -= _Update;
                        #endif
            _receiverIsReady   = false;
            _startUpFrameCount = 0;

            Spout.removeListener(TexShared, TexStopped);
            texture = null;
            GC.Collect();
        }
 void OnDisable()
 {
     //if(target == null)return;
     Spout.removeListener(texShared, senderStopped);
 }
示例#6
0
		void OnDestroy()
		{
			//Debug.Log("Spout.OnDestroy");
			if(_instance != this)return;
		
			if(_isInit){
			_CleanUpResources();
			}

			isReceiving = false;
			_isInit = false;
			newSenders = null;
			stoppedSenders = null;
			activeSenders = null;
			activeLocalSenders = null;
			localSenderNames = null;
			
			OnEnabled = null;
			OnSenderStopped= null;
			
			_instance = null;


			GC.Collect();//??

		}