Comments (11)
Hey Zeroc,
Thanks so much, I am glad you are liking the plugin. Let me know when the game is out, I am always interested to see what people are making with it.
removeTween is actually a method that is supposed to be used internally. I would have set the method to private, but I cannot since I need to access it from the LTDescr class. I know it's kind of messy, but I thought nobody would see the removeTween since it isn't mentioned in the docs :)
I added a comment, to make this more obvious..
from leantween.
The problem is with this function:
public static void cancel( GameObject gameObject, int uniqueId ){
if(uniqueId>=0){
init();
int backId = uniqueId & 0xFFFFFF;
int backType = uniqueId >> 24;
// Debug.Log("uniqueId:"+uniqueId+ " id:"+backId +" action:"+(TweenAction)backType + " tweens[id].type:"+tweens[backId].type);
if(tweens[backId].trans==null || (tweens[backId].trans.gameObject == gameObject && tweens[backId].type==(TweenAction)backType))
removeTween(backId);
}
}
I had to rewrite the funcion to make it work:
public static void cancel( GameObject gameObject, int uniqueId ){
if(uniqueId>=0){
init();
Transform trans = gameObject.transform;
for(int i = 0; i < tweenMaxSearch; i++){
if(tweens[i].trans==trans)
{
if (i == uniqueId)
{
removeTween(i);
}
}
}
}
}
from leantween.
hmmm, that works? the uniqueId shouldn't equal the iterator (the i variable), at least not necessarily.
Could you give me an example of how this cancel is being used in your code? Maybe email would be best to send files back and forth dentedpixel at gmail.com
Thanks!
from leantween.
I got the same probleme to cancel a delayedCall
if (timer != null) {
timer.cancel ();
LeanTween.removeTween (timer.uniqueId);
LeanTween.cancel (gameObject, timer.uniqueId);
}
timer = LeanTween.delayedCall (gameObject, TIME_TRANSITION, gotoDragAndDrop);
I can't cancel this timer. Like your see I tryed 3 different methods.
Actually I just want to reset the timer but I doesn't work either.
from leantween.
Hey Benoit,
I would just save the uniqueId at the start of the tween like:
var id:int = LeanTween.delayedCall(gameObject, 1f, someCall);
// later
LeanTween.cancel(gameObject, id);
If you do it that way it should work...
LeanTween.removeTween is only supposed to be used internally from the engine.
from leantween.
Thanks but delayedCall retunrs a LYDescr type not an int.
Cannot implicitly convert type LTDescr' to
int'
Is it possible to reset a delayedCall ?
Thanks.
from leantween.
Oh sorry, that was a typo, I meant:
var id:int = LeanTween.delayedCall(gameObject, 1f, someCall).id;
That way you shouldn't get an error. Canceling the delayedCall should effectively reset the delayedCall. Or you can cancle all tweens on a gameObject like:
LeanTween.cancel( gameObject );
from leantween.
Ok Thanks it's work! ;)
The method reset() in the LTDescr can reset (restart) a delayedCall?
Thanks.
from leantween.
Awesome.
No that reset method is only used internally to clear out old values before
re-using the tween for another purpose. I mean it might work actually, but
that's not what it is intended for, best to use LeanTween.cancel :)
On Mon, Feb 24, 2014 at 3:32 PM, Benoit Freslon [email protected]:
Ok Thanks it's work! ;)
The method reset() in the LTDescr can reset (restart) a delayedCall?
Thanks.
Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-35932283
.
Twitter - http://twitter.com/DentedPixel
Facebook - http://www.facebook.com/DentedPixel
Website - http://dentedpixel.com
from leantween.
I also got into this hole (
I think it's not expected behaviour when "pointer" (LTDescr) updates, but it depends of programming background.
from leantween.
hi @dentedpixel
I tried your solution, OnDisable()
and I received Error: `IndexOutOfRangeException: Index was outside the bounds of the array ID.```
So can I use way as an alternative method???
private LTSeq seqSample;
//Dosomething with Tween
public void DoSomething();
private void OnDisable()
{
//Triggerpoint I want cancel:
seqSample = null;
}
from leantween.
Related Issues (20)
- Any way to know how many instances of LeanTween is running? HOT 1
- isPaused copy-paste error
- Package Manager shipping ? HOT 1
- Please continue this magnificent package. Don't let it die... HOT 3
- "EndlessPiece" has missing script HOT 6
- LeanTween.move inconsistent HOT 3
- LeanTween.delayedCall does not clear when tween finishes
- Editor List renderer problem with Unity 2021.1 or higher.
- Unexpected pause & resume behavior HOT 2
- Documentation website isn't opening HOT 1
- SetFrom with SetDelay
- Does not contain sequence HOT 1
- Type or namespace 'LTSeq' could not be found HOT 3
- Weird bugs from .setIgnoreTimeScale(false) HOT 2
- Errors - Downloaded from Asset store getting Assets\LeanTween\Framework\LeanTweenExt.cs(31,166): error CS1503: Argument 3: cannot convert from 'System.Action' to 'Action' HOT 2
- Documentation Website not available HOT 3
- LeanTween.delayedCall() is bugged/unreliable, will occasionally not perform call HOT 3
- Rotation and Value Tween stopping even when no cancel called HOT 1
- LeanTween.scale seems to run perfectly first run, after it stop to run HOT 2
- Image alpha bug.
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 leantween.