コード例 #1
0
        private void OnEnable()
        {
            // Inject platform-specific dependencies

#if UNITY_EDITOR
            if (_processId < 0)
            {
                _processId = System.Diagnostics.Process.GetCurrentProcess().Id;
            }

            // Create settings object in the editor
            var serializedInstance = Resources.Load("FluvioManager", typeof(FluvioSettings)) as FluvioSettings;
            if (!serializedInstance)
            {
                var instance = FluvioSettings.GetFluvioSettingsObject();
                serializedInstance = CreateProjectSettingsAsset(instance, "Resources", "FluvioManager.asset");
            }
            FluvioSettings.SetFluvioSettingsObject(serializedInstance);
            FluvioComputeShader.SetIncludeParser(new ComputeIncludeParser());
            UnityEditor.EditorApplication.update += EditorUpdate;
#endif

            // OpenCL support
#if UNITY_STANDALONE// || UNITY_ANDROID // TODO - Android support for OpenCL is WIP
            Cloo.Bindings.CLInterface.SetInterface(new Cloo.Bindings.CL12());
#endif

            // Multithreading
#if !UNITY_WEBGL && !UNITY_WINRT
            _threadFactory             = new ThreadFactory();
            _threadHandler             = new ThreadHandler();
            _interlocked               = new Interlocked();
            FluidBase.onFluidEnabled  += OnFluidEnabled;
            FluidBase.onFluidDisabled += OnFluidDisabled;
            OnFluidEnabled(null);
#endif
        }
コード例 #2
0
        void OnEnable()
        {
            #if UNITY_EDITOR
            // Create settings object in the editor
            var serializedInstance = Resources.Load("FluvioManager", typeof(FluvioSettings)) as FluvioSettings;
            if (!serializedInstance)
            {
                var instance = FluvioSettings.GetFluvioSettingsObject();
                serializedInstance = CreateProjectSettingsAsset(instance, "Resources", "FluvioManager.asset");
            }
            FluvioSettings.SetFluvioSettingsObject(serializedInstance);
            FluvioComputeShader.SetIncludeParser(new ComputeIncludeParser());
            #endif

            // OpenCL support
            #if UNITY_STANDALONE// || UNITY_ANDROID // TODO - Android support for OpenCL is WIP
            Cloo.Bindings.CLInterface.SetInterface(new Cloo.Bindings.CL12());
            #endif

            // Multithreading
            #if !UNITY_WEBGL && !UNITY_WINRT
            Parallel.InitializeThreadPool(new FluvioThreadPool());
            #endif
        }