Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[Release] Event Player - Visual Play and Organize UnityEvent

Discussion in 'Assets and Asset Store' started by Threeyes, Jun 20, 2018.

  1. Threeyes

    Threeyes

    Joined:
    Jun 19, 2014
    Posts:
    32
    UnityEvent is good, but not good enough! What can we do, if we want to Visual reorder, reorganize or deactive events? Here comes the time saver:


    Call Me Whenever You Want
    The plugin provide following Components that can Invoke Events on different ways:
    • EventPlayer: It's the base class for other components, when you call Play/Stop Method, The certain UnityEvent will be Invoked. It also has severial properties:
      • IsActive
      • IsPlayOnAwake
      • IsPlayOnce
      • IsReverse
    upload_2018-6-20_13-35-10.png
    • EventPlayerGroup: Manage each child's Component that inherit from EventPlayer.
    组件列表.png
    • DelayEventPlayer: Play after [defaultDelayTime] seconds
    • RepeatEventPlayer: Repeat Play every [replayDeltaTime] seconds for about [dufaultDuration] seconds
    • TempEventPlayer: Play at once, and Stop after [dufaultDuration] seconds.
    You Know How It Works
    EventPlayer is a set of Components that take care of UnityEvents, and rely on gameobject states(parenting, active state, sibling index, etc). If you are familar with GameObject and how to parenting them in Hierarchy Window, then you are good to go.

    Show Me More!
    Let's say we have different events, instead of bind them into one EventPlayer, you can break them into several EventPlayer, place them under one EventPlayerGroup and call it instead:
    upload_2018-6-20_19-35-42.png
    With this improvement, we can do the following thing:
    • Change Event order: Rearrange childrens of EventPlayerGroup's GameObject.
    • Hide Event: Set specify EventPlayer's [IsActive] property as false.
    • Reuse Event: Just add a new EventPlayer and link to the Common EventPlayer!
    upload_2018-6-21_10-11-51.png
    Yes, It Involves Coroutine, But…
    The Coroutine will keep on working even if you deactive the GameObject of DelayEventPlayer/DelayEventPlayer/TempEventPlayer, so don't you worry about it;)

    Visual! (Ugly) Editor GUI!
    See that little toggle on the right side of Name Label?
    upload_2018-6-20_20-48-37.png
    The Toggle will help you check/change property or Invoke Method of EventPlayer without using the Inspector Window (you can also check/uncheck the toggle by press middle mouse button).

    Help!
    I know this plugin need more time to polish, please send me feedback, Thanks:):):)
     
    Last edited: Sep 22, 2020
    metroidsnes and MechEthan like this.
  2. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    419
    Does this work with Unity 2017.4?
     
  3. Threeyes

    Threeyes

    Joined:
    Jun 19, 2014
    Posts:
    32
    I had try it on 2017.3、 2018.1、 2018.2, everything works fine!
     
    Last edited: Jun 29, 2018
    EvOne likes this.
  4. dnoparker

    dnoparker

    Joined:
    Aug 28, 2013
    Posts:
    63
    I've noticed that the OnStop() event gets triggered on the very first frame. Regardless of where I've placed the thing on the timeline.
     
  5. Threeyes

    Threeyes

    Joined:
    Jun 19, 2014
    Posts:
    32
    Yes, It seems that timeline will call the OnBehaviourPause on the first frame, it make me sicks too:(
     
  6. dnoparker

    dnoparker

    Joined:
    Aug 28, 2013
    Posts:
    63
    I have since written my own Unity Event system for the timeline. I've figured out a way around the issue. Maybe this will help you! (if you are using PlayableBehaviour for this too)

    Code (CSharp):
    1.  
    2.     public override void OnBehaviourPause(Playable playable, FrameData info)
    3.     {
    4.         double time = playable.GetGraph().GetRootPlayable(0).GetTime();
    5.         if (time > 0)
    6.         {
    7.             /// DO THE EVENT
    8.         }
    9.  
    10.         base.OnBehaviourPause(playable, info);
    11.     }
    12.  
    13.  
    This will check if the timeline is on the first frame before executing the command. It prevents it from executing at the very beginning.
     
  7. Threeyes

    Threeyes

    Joined:
    Jun 19, 2014
    Posts:
    32
    Thanks for your advice, That's a good way to achieve! I think that Unity should give us a reset method such as OnBehaviourReset, so we don't have to check it manually:D.

    Anyway, I have update the plugin, it should be avaliable soon.
     
    Last edited: Aug 23, 2018
  8. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    118
    But: "The package has been submitted using Unity 2018.1.6." - makes it impossible for all my attempts to load your Asset into Unity 2017.4... :)
    Very sad...

    Sorry for Googletranslate
     
  9. Threeyes

    Threeyes

    Joined:
    Jun 19, 2014
    Posts:
    32
    My bad:D I have forget that the AssetStore API needs to update Plugin with the minimum Verstion, I have already reupload it again:) Thanks!
     
    Last edited: Sep 4, 2018
    EvOne likes this.
unityunity