Comments (11)
Hi,
Sorry for being late, I erroneously thought I had already answered you. Your tween doesn't play backwards because, by default, it's killed as soon as it completes. Add a SetAutoKill(false) to it if you want to reuse it (like playing it backwards after completion).
Cheers,
Daniele
from dotween.
I am using the newest version of DOTween and I am running into the same issue. I do not understand why this Issue got closed as the original code example actually states that autoKill is off. DOTween.defaultAutoKill = false;
I tried to use a simple fade tween and call PlayForward(), a bit later call PlayBackward(), then PlayForward() again. The issue is, if the first forward has completed, calling
PlayBackward();
PlayForward();
starts the tween from the beginning. I would expect it to stay at the end, because PlayBackward() never could run to the beginning:
sequence.PlayForward();
// let it complete
sequence.PlayBackward();
sequence.PlayForward(); // Note: no delay after calling backward
// tween starts from the beginning <-- unexpected
from dotween.
Ouch you're right. It's a different problem from the one @SharpEdgeMarshall had though (Fabio I didn't notice you had set AutoKill to false, but I can't replicate your issue so if you're still encountering it tell me more).
@Metallix, in your case it's because you're calling PlayForward the same frame of a PlayBackwards, immediately after, on an already completed tween. That's indeed a bug and this update (1.2.251) should fix it, can you check it out and let me know if everything's alright on your side too?
from dotween.
Thank you so much!
from dotween.
Hello!
Is this still a problem? Cause I'm having one, just not sure if it's me being an idiot or DOTween having a bug.
I'm using DOTween v1.2.745 on Unity 2022.3.1f1
I have this setup:
public class TransformAnomaly: IObjectAnomaly {
private Sequence _transformSequence;
public void Activate() {
Transform objectTransform = <...>;
_transformSequence = DOTween.Sequence().SetAutoKill(false);
// One of the ifs is true in this case, I checked in the debugger
// If ...
_transformSequence.Join(objectTransform.DOMove(newPosition, speed[0]));
// If ...
_transformSequence.Join(objectTransform.DORotate(newRotation, speed[1]));
// If ...
_transformSequence.Join(objectTransform.DOScale(newScale, speed[2]));
// Sequence above works, I see the effect on the GameObject
}
public void Deactivate() {
// At this point I can see in the debugger that Sequence is there with active = true, autoKill = false and isComplete = true
_transformSequence.PlayBackwards();
// PROBLEM HERE: the line above doesn't work. No errors, no effect.
}
}
Am I doing something wrong?
from dotween.
Ahoy!
I don't see anything wrong in your code, but what would help is if you set DOTween's log mode to Verbose (in DOTween Utility Panel > Preferences). That way if you call a method and it fails it will tell you why. Let me know!
from dotween.
In Unity window went to Tools > Demigiant > DOTween Utility Panel
On the top of the window - Preferences tab
Log Behaviour - switched to Verbose, then closed the window
Launched play mode to cause behaviour
On Activate(): message in console: DOTween initialization(useSafeMode: True, recycling: OFF, logBehaviour: Verbose)
On Deactivate(): nothing
Can it be recycling setting set to off? Was I supposed to turn it on at some point? (Sorry, it's literally my first time working with DOTween)
UPD: Nope, tried switching recycling option on in DOTween Utility Panel, same issue, same console message (except "recycling: ON" now)
from dotween.
I'm honestly very puzzled. I'm pretty sure that PlayBackwards has no bugs (also because I use it a lot), so there must be something I don't see that's happening (and no, recycling can't be the culprit: it's actually better off because DOTween recycles already by default and doesn't really need an extra layer).
Could you add an OnKill callback and an OnUpdate to your Sequence, to see if something else is killing it and if the update call is running (see the 2 rows I added after your initial Sequence creation line)?
public class TransformAnomaly: IObjectAnomaly {
private Sequence _transformSequence;
public void Activate() {
Transform objectTransform = <...>;
_transformSequence = DOTween.Sequence().SetAutoKill(false)
.OnKill(() => Debug.Log("Something killed me"))
.OnUpdate(() => Debug.Log("I am updating for real"));
// One of the ifs is true in this case, I checked in the debugger
// If ...
_transformSequence.Join(objectTransform.DOMove(newPosition, speed[0]));
// If ...
_transformSequence.Join(objectTransform.DORotate(newRotation, speed[1]));
// If ...
_transformSequence.Join(objectTransform.DOScale(newScale, speed[2]));
// Sequence above works, I see the effect on the GameObject
}
public void Deactivate() {
// At this point I can see in the debugger that Sequence is there with active = true, autoKill = false and isComplete = true
_transformSequence.PlayBackwards();
// PROBLEM HERE: the line above doesn't work. No errors, no effect.
}
}
from dotween.
Added OnKill() and OnUpdate() exactly as you suggested.
On Activate() it posts "I am updating for real" in the console once.
On Deactivate() it starts spamming "I am updating for real" non-stop.
from dotween.
I am super puzzled at this point, especially because if you see the tween when playing forward you should have OnUpdate spam you way more than once (and I'm sure there's no bugs with OnUpdate, it's a pretty solid system), so I need to see what else is happening. Can you repro it in a sample scene with a sample script and attach the package here?
from dotween.
While this is totally possible, I was being lazy, so I procrastinated by thinking about this OnUpdate() spam situation. And I think I've found the issue.
On all the Do<...>() methods the speed was set to 0, as I wanted an instant change this time. It worked in the case of playing the tween forward, but not backwards, as we see above. I changed the speed to 0.0000000001 and it's working forward and backwards now. At this speed, it still has just 1 update call, but PlayBack() is also working (and also has just 1 update call).
from dotween.
Related Issues (20)
- OnComplete problem (again of course) with singleton classes
- How to make OnUpdate and ChangeEndValue work properly?
- Index out of range error
- Startup errors not giving detailed warnings when default logging enabled
- DOComplete -> TweenManager.FilteredOperation: IndexOutOfRangeException (Possibly related to SetTweensCapacity?)
- [Feature Request] Assembly Definition & Version Define Resource HOT 1
- The DOTweenPath won't rotate or move with the parent
- WaitForCompletion stuck on recycled tween
- Can Dojump use endvalues ββthat change in real time?
- DoPath - Change waypoints during tween is running
- Combining Eases HOT 1
- UI Tweening works unreliably HOT 7
- NaN Input Error HOT 2
- Upgrading to Unity 6 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
- SetDelay is appending interval between two tween Joined in sequence HOT 2
- DOTween adds 2.7MB to WebGL build HOT 1
- Is DOJump not supported for Kinematic 3D Rigidbodies?
- Unity using DOTween pro UI creates ghost effect HOT 5
- Does not support the latest 6 preview?
- Demo link is no longer operational
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotween.