Skip to content

Commit c072cde

Browse files
committed
Merge branch 'hotfix/1.0.2'
2 parents b5c2507 + 17d009a commit c072cde

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/); this project adheres to [Semantic Versioning](http://semver.org/).
55

6+
-----------------------
7+
## [1.0.2] - 2019.05.19
8+
9+
### Fixed
10+
- Fixed `AsyncUtility.FrameUpdate()` not scheduling callbacks as expected.
11+
612
-----------------------
713
## [1.0.1] - 2019.04.09
814

src/UnityFx.Async.AssetStore/Assets/Plugins/UnityFx.Async/Scripts/AsyncUtility.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,14 +492,16 @@ private sealed class AsyncUtilityBehaviour : MonoBehaviour
492492
{
493493
#region data
494494

495+
private WaitForEndOfFrame _eof;
496+
private Coroutine _eofCoroutine;
497+
495498
private Dictionary<object, Action> _ops;
496499
private List<KeyValuePair<object, Action>> _opsToRemove;
497500

498501
private AsyncUpdateSource _updateSource;
499502
private AsyncUpdateSource _lateUpdateSource;
500503
private AsyncUpdateSource _fixedUpdateSource;
501504
private AsyncUpdateSource _eofUpdateSource;
502-
private WaitForEndOfFrame _eof;
503505

504506
#if NET_4_6 || NET_STANDARD_2_0
505507

@@ -567,8 +569,11 @@ public IAsyncUpdateSource EofUpdateSource
567569
if (_eofUpdateSource == null)
568570
{
569571
_eofUpdateSource = new AsyncUpdateSource();
570-
_eof = new WaitForEndOfFrame();
571-
StartCoroutine(EofEnumerator());
572+
}
573+
574+
if (_eofCoroutine == null)
575+
{
576+
_eofCoroutine = StartCoroutine(EofEnumerator());
572577
}
573578

574579
return _eofUpdateSource;
@@ -603,6 +608,12 @@ public void AddFrameCallback(Action callback, FrameTiming timing)
603608
break;
604609

605610
case FrameTiming.EndOfFrame:
611+
612+
if (_eofCoroutine == null)
613+
{
614+
_eofCoroutine = StartCoroutine(EofEnumerator());
615+
}
616+
606617
AddFrameCallback(ref _eofUpdateActions, callback);
607618
break;
608619
}
@@ -612,6 +623,11 @@ public void AddFrameCallback(Action callback, FrameTiming timing)
612623

613624
#region MonoBehavoiur
614625

626+
private void Awake()
627+
{
628+
_eof = new WaitForEndOfFrame();
629+
}
630+
615631
private void Update()
616632
{
617633
if (_ops != null && _ops.Count > 0)
@@ -840,7 +856,9 @@ private IEnumerator EofEnumerator()
840856
{
841857
InvokeFrameCallbacks(_eofUpdateActions, this);
842858
}
843-
}
859+
860+
_eofCoroutine = null;
861+
}
844862

845863
#endregion
846864
}

0 commit comments

Comments
 (0)