Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Execute After, Execute before

Discussion in 'Project Tiny' started by sniffle63, Mar 10, 2019.

  1. sniffle63

    sniffle63

    Joined:
    Aug 31, 2013
    Posts:
    365
    I really hesitate to post this, because iv seen so many other post about this... but after reading the other post and the documents. I just dont seem to understand how the execute before/execute after works.

    Can someone please explain why im unable to use
    Code (CSharp):
    1. @ut.executeAfter(game.PlayerInputSystem)
    on these files?
    It allows me to do it on the FlipSystem.ts but not the other files

    Code_2019-03-10_15-52-09.png Code_2019-03-10_15-52-12.png Code_2019-03-10_15-52-14.png Code_2019-03-10_15-52-16.png
     
  2. sniffle63

    sniffle63

    Joined:
    Aug 31, 2013
    Posts:
    365
    Doing it like this, gives no errors in the editor. But i havent actually printed a line out to make sure its executing in the right order. And it also still says i have an error inside the IDE. Also im pretty sure doign it this way is weird.

    I was also *unable* to execute the movement system before the scale system with @executebefore(scalesystem) in my movement system.

    Code_2019-03-10_16-04-31.png Code_2019-03-10_16-04-34.png Code_2019-03-10_16-04-36.png Code_2019-03-10_16-04-39.png
     
  3. sniffle63

    sniffle63

    Joined:
    Aug 31, 2013
    Posts:
    365
    Using the input fence on my MovementSystem.ts to execute that after input works. But then i still cant tell my animationSystem.ts to execute after my MovementSystem.ts

    and from my understanding, i need to make sure the AnimationSystem is always running after my movmentSystem. Because my animationSystem reads data from the movementSystem, and if it doesnt read it after that file, the data its reading could be from the frame before, and not the current frame. Which would introduce a "lag"

    I feel like im missing something with the "used before its deceleration" thing


    using

    Code (CSharp):
    1. @ut.executeAfter(ut.Shared.InputFence)
    on movementSystem

    and

    Code (CSharp):
    1. @ut.executeAfter(ut.Shared.UserCodeEnd)
    on AnimationSystem and ScaleSystem

    gives the correct order of console.Logs so i guess ill just use that. But i would really likea reply explaining my missunderstanding of how this works
     
    Last edited: Mar 10, 2019
  4. Pakor

    Pakor

    Joined:
    Feb 2, 2017
    Posts:
    32
    What you want to do is give a reference path to the script you want to execute first in the top of your script. Like so:


    Code (CSharp):
    1. /// <reference path="../Scripts/Example.ts" />
    2.  
    3. namespace game
    4. {
    5.     /**A System that is an example*/
    6.     ut.executeAfter(Example)
    7.     export class Explanation extends ut.ComponentSystem
    8.     {
    9.  
    10.     }
    11. }
    This should be the correct way of doing it. Someone correct me if I am wrong
     
    sniffle63 and Deleted User like this.
  5. Deleted User

    Deleted User

    Guest

    When I receive those errors, I only add a comment over it and done

    Code (CSharp):
    1.  
    2. namespace game
    3. {
    4.     // @ts-ignore
    5.     @ut.executeAfter(Example)
    6.     export class Explanation extends ut.ComponentSystem
    7.     {
    8.     }
    9. }
    10.  
     
    sniffle63 likes this.
  6. sniffle63

    sniffle63

    Joined:
    Aug 31, 2013
    Posts:
    365
    Thanks alot for the replies!