You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not entirely sure of what's the use for CompositeMotionHandle, but I see it's used to aggregate different motions in a single handle, in a similar way to what LSequence would do if we only Join all motions. Please let me know if I'm missing an existing way to do this.
In our code we use CancellationTokens and AddTo to know if the motions should stop earlier than expected, and sometimes there's many tweens, meaning we have to add AddTo and/or ToUniTask for each one of them.
I think it would be useful to aggregate all of them in a CompositeMotionHandle and apply those operations to the whole lot, once.
Another suggestion, which I think won't be very loved (but I've got to say it), is that I would like a way to add items to a CompositeMotionHandle or MotionSequenceBuilder without having to add parentheses each time.
Motions usually take a few lines if we want them to be readable, and parentheses don't help keeping code readable when there are many tweens going on. The idea that comes to my mind is overriding compound assignment operators to Add, Append, Join, etc.
I'm not the n1 fan of this solution anyway since it abuses operator overriding, but maybe you come up with something better. I personally like not having to add another tab and avoiding noise.
In the case of CompositeMotionHandles, the operator += could be used to add new handles, and that doesn't feel so bad for me because it's similar to how delegates work by default.
In this last code it would be much faster to iterate and quickly prepend the motions into a sequence (even using multi-cursor in some IDEs), besides having to select them, surround them with parenthesis and properly indent one by one.
One last thing for which I don't really have an answer, but wanted to make you aware of. Since MotionSequenceBuilder implements IDisposable, it's possible to do sequence.AddTo(cancellationToken) (defined in Cysharp.Threading.Tasks.CancellationTokenExtensions).
I'm not sure what happens in that case because I noticed the difference soon enough, but looking at the code seems like a very different behavior than MotionHandle.AddTo() and looks like mistaking them could result in many hours of debugging.
The text was updated successfully, but these errors were encountered:
I'm not entirely sure of what's the use for
CompositeMotionHandle
, but I see it's used to aggregate different motions in a single handle, in a similar way to whatLSequence
would do if we onlyJoin
all motions. Please let me know if I'm missing an existing way to do this.In our code we use
CancellationTokens
andAddTo
to know if the motions should stop earlier than expected, and sometimes there's many tweens, meaning we have to addAddTo
and/orToUniTask
for each one of them.I think it would be useful to aggregate all of them in a
CompositeMotionHandle
and apply those operations to the whole lot, once.Another suggestion, which I think won't be very loved (but I've got to say it), is that I would like a way to add items to a
CompositeMotionHandle
orMotionSequenceBuilder
without having to add parentheses each time.Motions usually take a few lines if we want them to be readable, and parentheses don't help keeping code readable when there are many tweens going on. The idea that comes to my mind is overriding compound assignment operators to
Add
,Append
,Join
, etc.I'm not the n1 fan of this solution anyway since it abuses operator overriding, but maybe you come up with something better. I personally like not having to add another tab and avoiding noise.
In the case of
CompositeMotionHandle
s, the operator+=
could be used to add new handles, and that doesn't feel so bad for me because it's similar to how delegates work by default.Before
After
In this last code it would be much faster to iterate and quickly prepend the motions into a sequence (even using multi-cursor in some IDEs), besides having to select them, surround them with parenthesis and properly indent one by one.
One last thing for which I don't really have an answer, but wanted to make you aware of. Since
MotionSequenceBuilder
implementsIDisposable
, it's possible to dosequence.AddTo(cancellationToken)
(defined inCysharp.Threading.Tasks.CancellationTokenExtensions
).I'm not sure what happens in that case because I noticed the difference soon enough, but looking at the code seems like a very different behavior than
MotionHandle.AddTo()
and looks like mistaking them could result in many hours of debugging.The text was updated successfully, but these errors were encountered: