void OnDisable()
        {
            _detector?.Dispose();
            _detector = null;

            _drawArgs?.Dispose();
            _drawArgs = null;
        }
示例#2
0
        void Start()
        {
            // Texture allocation
            _webcamRaw    = new WebCamTexture();
            _webcamBuffer = new RenderTexture(1920, 1080, 0);
            _webcamRaw.Play();

            // Object detector initialization
            _detector = new ObjectDetector(_resources);

            // Shader initialization
            _material = new Material(_shader);
            _drawArgs = new ComputeBuffer
                            (4, sizeof(uint), ComputeBufferType.IndirectArguments);
            _drawArgs.SetData(new [] { 6, 0, 0, 0 });
        }