Search Unity

[REQUEST] Tweens and Watchers

Discussion in 'Project Tiny' started by vincismurf, Feb 3, 2019.

  1. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    172
    Could someone provide or point to a example that has working Tweens and Watchers.

    Updated - see below
     
    Last edited: Feb 5, 2019
  2. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    172
    Success!!!!

    Add Tween
    Code (JavaScript):
    1.  
    2.  
    3. let tweenEntity:ut.Entity = ut.Tweens.TweenService.addTween(this.world,this.data.zeta.fader, ut.Core2D.Sprite2DRenderer.color.a, 1, 0,3,0, ut.Core2D.LoopMode.Once,ut.Tweens.TweenFunc.InOutQuart, true);
    4.  
    Schedule watcher
    Code (JavaScript):
    1.  
    2. let watcher:ut.Watchers.WatchGroup = new ut.Watchers.WatchGroup();
    3. watcher.watchChanged(this.world,this.data.zeta.fader, ut.Core2D.Sprite2DRenderer.color.a, this.OnTweenComplete );
    4. watcher.schedule(this.scheduler);
    5.  
    6.  
    Callback
    Code (JavaScript):
    1.  
    2. OnTweenComplete (e: ut.Entity, cid: number, offset: number, prevValue: number, newValue: number, watchId: number)
    3. {
    4.    let rounded:string = newValue.toFixed(3);
    5.    if(rounded == "0.000")
    6.    {
    7.         console.log("OnTweenComplete !!!!!!!!!!!!!!!");
    8.  
    9.    }
    10. }
    11.  
     
    CloverDev and abeisgreat like this.
  3. Laureus

    Laureus

    Joined:
    Jul 11, 2017
    Posts:
    1
    Does this also work in a release build ?
     
  4. reallyhexln

    reallyhexln

    Joined:
    Jun 18, 2018
    Posts:
    69
    I spent many time to understand why Tweens and Watchers just doesn't working for me.
    Solution was weird - they both should be enabled in Modules window before use.

     
    vincismurf likes this.