Coder Social home page Coder Social logo

Comments (11)

dentedpixel avatar dentedpixel commented on June 30, 2024

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.

zeroc avatar zeroc commented on June 30, 2024

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.

dentedpixel avatar dentedpixel commented on June 30, 2024

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.

BenoitFreslon avatar BenoitFreslon commented on June 30, 2024

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.

dentedpixel avatar dentedpixel commented on June 30, 2024

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.

BenoitFreslon avatar BenoitFreslon commented on June 30, 2024

Thanks but delayedCall retunrs a LYDescr type not an int.

Cannot implicitly convert type LTDescr' toint'

Is it possible to reset a delayedCall ?

Thanks.

from leantween.

dentedpixel avatar dentedpixel commented on June 30, 2024

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.

BenoitFreslon avatar BenoitFreslon commented on June 30, 2024

Ok Thanks it's work! ;)

The method reset() in the LTDescr can reset (restart) a delayedCall?

Thanks.

from leantween.

dentedpixel avatar dentedpixel commented on June 30, 2024

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.

dimmduh avatar dimmduh commented on June 30, 2024

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.

iletai avatar iletai commented on June 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.