Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

[REQUEST] Tweens and Watchers

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

  1. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    200
    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:
    200
    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:
    4
    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.