コード例 #1
0
ファイル: FluidMixer.cs プロジェクト: amplify123/UnityTest
        protected override void OnEnablePlugin()
        {
            m_FirstFrame = true;

            SetComputeShader(FluvioComputeShader.Find("ComputeShaders/SamplePlugins/FluidMixer"), "OnUpdatePlugin");

#if UNITY_5_5
            // BUG: Unity 5.5.0 and 5.5.1 may crash in edit mode when emitting particles
            var unityVersion = Application.unityVersion;
            _disableInEditMode = unityVersion.StartsWith("5.5.0") || unityVersion.StartsWith("5.5.1");
            if (_disableInEditMode && !Application.isPlaying && !_showedWarning)
            {
                FluvioDebug.LogWarning(string.Format("Due to Unity issue #862897, the {0} fluid plugin cannot run in edit mode.", GetType()));
                _showedWarning = true;
            }
#endif
        }
コード例 #2
0
        void ExecuteThread()
        {
            s_ThreadWaitTime = 1;
            while (!m_ShouldStopThreads && m_ActionQueue != null)
            {
                // Wait
                if (!m_QueueIsNotEmptyEvent.WaitOne(s_ThreadWaitTime) && m_ActionQueue.isEmpty)
                {
                    if (s_ThreadWaitTime < 8)
                    {
                        s_ThreadWaitTime *= 2;
                    }
                    continue;
                }

                // Try to dequeue
                var action = m_ActionQueue.Dequeue();

                // We missed, queue is empty
                if (action == null)
                {
                    m_QueueIsNotEmptyEvent.Reset();
                    continue;
                }

                s_ThreadWaitTime = 1;

                try
                {
                    action();
                }
                catch (Exception e)
                {
                    if (!(e is ThreadAbortException))
                    {
                        FluvioDebug.LogError(string.Format("Unhandled {0} caught on background thread ({1}) - task aborted.\n{2}", e.GetType().Name, e.Message, e.StackTrace), this);
                    }
                }
            }
        }