Exemplo n.º 1
0
    private CustomSampler AttachCustomRecorder(string label, int slot)
    {
        CustomSampler newSampler = CustomSampler.Create(label);

        recorders[slot] = newSampler.GetRecorder();
        isCustom[slot]  = true;
        profilerData.recorderData[slot].label = label;
        if (!newSampler.isValid)
        {
            Debug.LogWarningFormat("ProfilerHUD: recorder \"{0}\" is either invalid or temporarily unavailable", label);
        }
        return(newSampler);
    }
    void Start()
    {
        sampler  = CustomSampler.Create("GPURecorder_Example", true);
        recorder = sampler.GetRecorder();

        CommandBuffer cmd = new CommandBuffer();

        cmd.name = "GPURecorder_Example";
        cmd.BeginSample(sampler);
        cmd.ClearRenderTarget(false, true, Color.green);
        cmd.EndSample(sampler);

        if (cam == null)
        {
            cam = Camera.main;
        }
        if (cam != null)
        {
            cam.AddCommandBuffer(evt, cmd);
        }
    }