SHA256
Add OnLastUpdate Callback to API
This commit is contained in:
3 files changed
+33
-2
No files matched your search
@@ -39,6 +39,7 @@ public class RenderSession
|
||||
|
||||
private Func<bool>? _endCondition;
|
||||
private Action<RenderResult>? _onComplete;
|
||||
private Action? _onLastUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether auto mode is enabled.
|
||||
@@ -114,6 +115,17 @@ public class RenderSession
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a callback action to be invoked on the last update of each frame in the render session.
|
||||
/// </summary>
|
||||
/// <param name="callback">The callback action to execute.</param>
|
||||
/// <returns>The current <see cref="RenderSession"/> instance for method chaining.</returns>
|
||||
public RenderSession OnLastUpdate(Action callback)
|
||||
{
|
||||
_onLastUpdate += callback;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the configured flags and initiates the render session.
|
||||
/// </summary>
|
||||
@@ -130,6 +142,7 @@ public class RenderSession
|
||||
|
||||
if (_endCondition is not null) RenderContext.EndCondition = _endCondition;
|
||||
if (_onComplete is not null) RenderContext.OnComplete = _onComplete;
|
||||
if (_onLastUpdate is not null) RenderContext.OnLastUpdate = _onLastUpdate;
|
||||
|
||||
RenderManager.Instance.levelPath = levelPath;
|
||||
RenderManager.Instance.Configuration = renderConfig;
|
||||
|
||||
Reference in new issue
Block a user