feat: added UpdateManager.CallFirstActiveFrameImmediately method for early calls of behaviours
This commit is contained in:
@@ -44,6 +44,17 @@ public class UpdateManager : Behaviour, IEnterUniverse, IExitUniverse
|
||||
universe.OnPostUpdate.RemoveListener(OnPostUpdate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call the <see cref="IFirstFrameUpdate"/> early if it's in queue to be called by this the <see cref="UpdateManager"/>.
|
||||
/// It will not be called in the next natural cycle.
|
||||
/// </summary>
|
||||
/// <param name="instance">The instance that will be called now rather than later.</param>
|
||||
public void CallFirstActiveFrameImmediately(IFirstFrameUpdate instance)
|
||||
{
|
||||
if (toCallFirstFrameUpdates.Remove(instance))
|
||||
instance.FirstActiveFrame();
|
||||
}
|
||||
|
||||
private void OnFirstUpdate(IUniverse sender, IUniverse.UpdateArguments args)
|
||||
{
|
||||
for (int i = toCallFirstFrameUpdates.Count - 1; i >= 0; i--)
|
||||
|
||||
Reference in New Issue
Block a user