File tree Expand file tree Collapse file tree 1 file changed +19
-11
lines changed
UnityAsync/Assets/UnityAsync/Manager Expand file tree Collapse file tree 1 file changed +19
-11
lines changed Original file line number Diff line number Diff line change 11using System ;
22using System . Runtime . CompilerServices ;
3+ using UnityEngine ;
34
45namespace UnityAsync
56{
@@ -53,20 +54,27 @@ public void Process()
5354 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
5455 public void Add ( in T cont )
5556 {
56- if ( futureCount == maxIndex )
57+ try
5758 {
58- AssertQueueSize ( futureCount + 1 ) ;
59+ if ( futureCount >= maxIndex )
60+ {
61+ AssertQueueSize ( futureCount + 1 ) ;
62+
63+ int newQueueSize = Math . Min ( MaxQueueSize , futureQueue . Length * 3 / 2 ) ;
5964
60- int newQueueSize = Math . Min ( MaxQueueSize , futureQueue . Length * 3 / 2 ) ;
61-
62- Array . Resize ( ref futureQueue , newQueueSize ) ;
63- Array . Resize ( ref currentQueue , newQueueSize ) ;
64-
65- maxIndex = newQueueSize - 1 ;
65+ Array . Resize ( ref futureQueue , newQueueSize ) ;
66+ Array . Resize ( ref currentQueue , newQueueSize ) ;
67+
68+ maxIndex = newQueueSize - 1 ;
69+ }
70+
71+ futureQueue [ futureCount ] = cont ;
72+ ++ futureCount ;
73+ }
74+ catch ( Exception e )
75+ {
76+ Debug . LogException ( e ) ;
6677 }
67-
68- futureQueue [ futureCount ] = cont ;
69- ++ futureCount ;
7078 }
7179
7280 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
You can’t perform that action at this time.
0 commit comments