Skip to main content

SRP Setup

To setup a simple SRP you can add the compilation define EVOLVEUI_ENABLE_URP.

You can do this in Project Settings / Player / Scripting Compilation / Scripting Define Symbols

Once this is active you see an option on your render pipeline to use EvolveUISimpleSRP. Note that this requires you to use a loading component like UIRoot that implements IEvolveApplication and that the IEvolveApplication must be on the same gameObject as the camera that you want to use to render UI with.

You can also make your own ScriptableRenderPass that invokes Evolve's render pipeline. The bundled render pass is extremely simple:

public class EvolveUISimpleSRP : ScriptableRendererFeature {

public override void Create() { }

public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) {
Camera camera = renderingData.cameraData.camera;

IEvolveApplication app = camera.GetComponent<IEvolveApplication>();

if (app?.application == null) {
return;
}

renderer.EnqueuePass(new EvolveSimpleRenderPass(app.application));
}

}

internal class EvolveSimpleRenderPass : ScriptableRenderPass {

private readonly UIApplication evolveApp;

public EvolveSimpleRenderPass(UIApplication evolveApp) {
this.evolveApp = evolveApp;
}

public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) {

Camera camera = renderingData.cameraData.camera;

if (camera != evolveApp.camera) {
return;
}

ProjectionSetup setup = evolveApp.GetOrthoProjectionSetup(renderingData.cameraData.IsCameraProjectionMatrixFlipped());
evolveApp.Render(setup, camera.targetTexture);
context.ExecuteCommandBuffer(evolveApp.GetCommandBuffer());
}

}