-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non functioning Tween when reusing a GoTween instance with modified TweenProperties #74
Comments
is Random() a function of yours, or is this pseudocode? If it's the latter, can you paste something closer to what you're actually using? I'll take a peek at the source myself, and see if there's anything else I might be able to suggest. |
Pseudocode. In actual use, I'm tweening the value of a health bar for a game. Each time the tween happens, I'm changing the IntTweenProperty's |
Is there a reason why you're not creating a new tween, rather than trying
On Thu, Jan 28, 2016 at 8:39 AM, seandanger [email protected]
|
I'm aiming to keep the Tween in memory (as a field in this particular class) and reuse it over and over again instead of allocating a new one each time. My original goal was to re-use the property too, but the IntTweenProperty class has no way of changing the target As an aside, I've extended IntTweenProperty and added the ability to change the Here's that class in case anyone is interested, note that
|
So I spent a bit more time looking into this, and thinking about it. Right now we have a smattering of properties that actually have One more thing to consider, doing something like this doesn't necessarily reset the startValue of the tween, so while doing something like this may allow you to keep a tween in memory and edit the property targets willy-nilly, you're not guaranteed to have a great looking result depending on when you do reset the desired end value to something else. |
I'm saving instances of tweens that need to be reused often, with minor TweenProperty changes. Here's what my code looks like:
This works the first time the tween is used, but after that, the value set by the tween is always 0 instead of
newValue
.From debugging, it looks like the newly added TweenProperty is never getting its
prepareForUse()
method called, which normally happens in GoTween'sonInit()
. I think eitherprepareForUse()
should be called on new properties added viaaddTweenProperty()
if the GoTween's_didInit
is true, or there should be exposed aReset()
method to set the_didInit
field back to false on the GoTween, so it will properly callprepareForUse()
on all TweenProperties.I'll experiment with these fixes and submit a pull request once I have a proper fix, but it would be nice to hear from an author with more knowledge of the code as to what the best solution is.
The text was updated successfully, but these errors were encountered: