Description
The AddHookBeforeOverlay
method allows you to add a custom rendering effect to be executed before the overlay stage of the camera's rendering process. This can be useful for applying effects or modifications to the scene before any overlay elements are drawn.
Usage
To use the AddHookBeforeOverlay
method, you need to provide a debug name for the hook, an order value to determine the execution sequence, and a delegate that defines the rendering effect to be applied. The method returns an IDisposable
object, which can be used to remove the hook when it is no longer needed.
Example
// Example of using AddHookBeforeOverlay
CameraComponent cameraComponent = new CameraComponent();
IDisposable hook = cameraComponent.AddHookBeforeOverlay(
"MyCustomEffect",
10,
(sceneCamera) =>
{
// Custom rendering logic here
// Example: sceneCamera.ApplyEffect(myEffect);
}
);
// Later, when you want to remove the hook
hook.Dispose();