System.IDisposable AddHookAfterOpaque( string debugName, int order, System.Action<SceneCamera> renderEffect )

robot_2Generated
code_blocksInput

Description

The AddHookAfterOpaque method allows you to add a rendering hook that executes after the opaque rendering stage in the camera's rendering pipeline. This method is marked as obsolete, indicating that it may be removed in future versions and should be avoided in new code.

Usage

To use AddHookAfterOpaque, provide a debugName for identification, an order to determine the execution sequence, and a renderEffect action that defines the rendering logic to be executed. The method returns an IDisposable object, which can be used to remove the hook when disposed.

Example

// Example usage of AddHookAfterOpaque
using Sandbox;

public class MyCameraComponent : CameraComponent
{
    public void SetupRenderingHook()
    {
        // Define the rendering effect
        Action<SceneCamera> renderEffect = (camera) =>
        {
            // Custom rendering logic here
        };

        // Add the hook
        IDisposable hook = AddHookAfterOpaque("MyDebugName", 0, renderEffect);

        // Dispose the hook when no longer needed
        // hook.Dispose();
    }
}