UIEffectSnapshot
UIEffectSnapshot copied to clipboard
Getting access to RenderTexture in UIEffectSnapshot.CaptureForGlobal callback
I'm trying to get blur without UIEffectSnapshot component, just using API UIEffectSnapshot.CaptureForGlobal
. But there is no option to get RenderTexture in callback.
The Script usage section says that I need to use UIEffectSnapshot.globalCapturedTexture
but it is unpossible bacause it is non-static. So I see two possible options here:
- Make property
UIEffectSnapshot.globalCapturedTexture
static - Make property
UIEffectSnapshotRequest.renderTexture
public
For now I'm using reflection as temporary solution:
UIEffectSnapshot.CaptureForGlobal(callback: request =>
{
var prop = request.GetType().GetProperty("renderTexture", BindingFlags.Instance | BindingFlags.NonPublic);
source.TrySetResult((RenderTexture)prop.GetValue(request));
});
_blurredTexture = await source.Task;