Dispose() public method

public Dispose ( ) : void
return void
 static public int Dispose(IntPtr l)
 {
     try {
         UnityEngine.Rendering.CommandBuffer self = (UnityEngine.Rendering.CommandBuffer)checkSelf(l);
         self.Dispose();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int Dispose(IntPtr l)
 {
     try {
         UnityEngine.Rendering.CommandBuffer self = (UnityEngine.Rendering.CommandBuffer)checkSelf(l);
         self.Dispose();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
    public void InitializeBuffers()
    {
        if (m_occlusionCmdAfterShadows != null)
        {
            m_occlusionCmdAfterShadows.Dispose();
        }
        if (m_occlusionCmdBeforeScreen != null)
        {
            m_occlusionCmdBeforeScreen.Dispose();
        }

        m_occlusionCmdAfterShadows      = new UnityEngine.Rendering.CommandBuffer();
        m_occlusionCmdAfterShadows.name = "Scatter Occlusion Pass 1";
        m_occlusionCmdAfterShadows.SetGlobalTexture("u_CascadedShadowMap", new UnityEngine.Rendering.RenderTargetIdentifier(UnityEngine.Rendering.BuiltinRenderTextureType.CurrentActive));
        m_occlusionCmdBeforeScreen      = new UnityEngine.Rendering.CommandBuffer();
        m_occlusionCmdBeforeScreen.name = "Scatter Occlusion Pass 2";
    }
    void EnsureHookedLightSource(Light light)
    {
        if (!light)
        {
            return;
        }

        if (light.commandBufferCount == 2)
        {
            return;
        }

        //Debug.Log("Hooking scattering command buffers on light source: " + light.name);

        // NOTE: This doesn't really play nicely with other users of light events.
        //       Currently not an issue since this code was written pre-5.1 (and light events
        //       are a new feature in 5.1), but might need a proper solution in the future.
        light.RemoveAllCommandBuffers();

        if (m_occlusionCmdAfterShadows != null)
        {
            m_occlusionCmdAfterShadows.Dispose();
        }
        if (m_occlusionCmdBeforeScreen != null)
        {
            m_occlusionCmdBeforeScreen.Dispose();
        }

        m_occlusionCmdAfterShadows      = new UnityEngine.Rendering.CommandBuffer();
        m_occlusionCmdAfterShadows.name = "Scatter Occlusion Pass 1";
        m_occlusionCmdAfterShadows.SetGlobalTexture("u_CascadedShadowMap",
                                                    new UnityEngine.Rendering.RenderTargetIdentifier(
                                                        UnityEngine.Rendering.BuiltinRenderTextureType.CurrentActive));
        m_occlusionCmdBeforeScreen      = new UnityEngine.Rendering.CommandBuffer();
        m_occlusionCmdBeforeScreen.name = "Scatter Occlusion Pass 2";

        light.AddCommandBuffer(UnityEngine.Rendering.LightEvent.AfterShadowMap, m_occlusionCmdAfterShadows);
        light.AddCommandBuffer(UnityEngine.Rendering.LightEvent.BeforeScreenspaceMask, m_occlusionCmdBeforeScreen);
    }