Search Unity

How to use LeanTween.value()?

Discussion in 'Scripting' started by Tongie, Mar 26, 2013.

  1. Tongie

    Tongie

    Joined:
    Sep 19, 2012
    Posts:
    90
    Code (csharp):
    1.  
    2.  
    3. public static void Value()
    4. {
    5.    float from1 = 0.0f;
    6.    float to = 1.0f;
    7.    float time = 3.0f;
    8.    Hashtable options = new Hashtable();
    9.    LeanTween.value(updateNewValue, from1, to, time, options);
    10. }
    11.  
    12. private static void updateNewValue(float hi)
    13. {
    14.     print(hi);
    15. }
    16.  
    17.  
    Hi guys, i got a problem, hope you guys can help me out. I use the above code and i got these 2 error? Whats wrong?

    1) The best overloaded method match for `LeanTween.value(Boo.Lang.ICallable, float, float, float, System.Collections.Hashtable)' has some invalid arguments

    2) Argument `#1' cannot convert `method group' expression to type `Boo.Lang.ICallable'
     
  2. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hi Tongie, I could be wrong, but I think it may be because you are using a static method, I am not sure if that is possible with a callback... you may try something more like:

    ClassName.updateNewValue

    to pass as a value instead...
     
  3. Tongie

    Tongie

    Joined:
    Sep 19, 2012
    Posts:
    90
    Yup its was the static that prevent it from working and convert updateNewValue to "updateNewValue". Thanks alot...!
     
  4. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    hi, dentedpixel i'm trying to use LeanTween.value with the same example ,

    int from1 = 0.0f;
    int to = 1.0f;
    float time = 3.0f;

    LeanTween.value(currentSCore, from1, to, time );

    what's wrong ? i don't get it
     
  5. AmirArdy

    AmirArdy

    Joined:
    Jan 7, 2018
    Posts:
    3
    I was struggling with this function ( LeanTween.value ) and documentation is not quite useful. so I find out the best way to use it, is to read comments in the function implementation. there is usually an example within the function in the comment.
    upload_2020-3-30_18-51-51.png
     
    Myst1cS04p, puppeteer, no00ob and 4 others like this.