Search Unity

UltEvents - The Ultimate Event System For The Ultimate Price - FREE

Discussion in 'Assets and Asset Store' started by Kybernetik, Jun 1, 2019.

  1. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    858
    title.png
    [itch.io] [Asset Store] [Documentation] [Forum] [mail@kybernetik.com.au]

    UltEvents allows you to easily setup and configure persistent event callbacks via the Inspector. It serves the same purpose as the inbuilt UnityEvents, but has superior features with fewer restrictions and an improved Inspector interface which requires fewer clicks to perform individual tasks.

    Download it for FREE from itch.io (recommended) or the Unity Asset Store and check out the Documentation to get started.

    trigger-event.png

    UltEvents have superior features with fewer restrictions than UnityEvents:
    • Supports more parameter types: Enum (regular and flags), Vector (2, 3, 4), Quaternion, Rect, Color, Color32.
    • Call methods with multiple parameters (UnityEvents can only do 0 or 1).
    • Call methods with non-void return types and use the returned value as a parameter in subsequent calls.
    • Call non-public and static methods.
    • Full source code is included and well documented so it is easy to modify if necessary.
    UltEvents have an improved Inspector:
    • Collapse the event into a single line to occupy less screen space.
    • Parameter-less functions only take a single line.
    • Function parameter names are displayed. You can see the full method signature instead of only the name.
    • Select a listener on a specific Component when there is more than one of the same type on the target object.
    • Drag listeners around to reorder them.
    • Keyboard shortcuts and context menu functions allow you to easily Copy, Paste, Add, Delete, and even Invoke events.
    • Better organised method selection menus which can be customised to suit your needs.
    • Button to quickly find a similarly named method if the target is missing.
    • Dynamic listeners are displayed in the footer (ones added by code).
    Individual tasks also tend to require fewer clicks with UltEvents:
    • Instead of needing to add a new listener then drag in a target, you can just drag the target onto the event header.
    • Instead of needing to select a listener then press the remove button in the footer, each listener has its own remove button.
    • If you assign a specific Component as the target, it will immediately open the method selection menu which will let you select methods directly from that component instead of going through a sub-menu every time.
    See the documentation for the full feature comparison.

    If you like this asset, please consider supporting me by donating on itch.io or buying some of my other assets which are listed in my signature.
     
    Last edited: Mar 6, 2020
    Gekigengar and nirvanajie like this.
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    858
    UltEvents v2.0 is now up on the Asset Store:
    • Moved everything out of the precompiled DLL to make it easier to access and modify the source code.
    Warning: when upgrading from an earlier version you must delete the old version before importing the new one. This will also cause all of the Premade Event Scripts in your project to go missing so you will need to set them all up again. This is an unfortunate side effect of the way Unity handles references to scripts inside a DLL compared to regular script files.
    • Replaced PDF user manual with a website hosted at https://kybernetikgames.github.io/ultevents.
    • Added support for constructors.
    • Added interfaces corresponding to all UltEvent types so that the ability to add and remove listeners can be exposed without exposing the ability to invoke, clear, or access other members of the event.
    • Fixed cached PersistentArgument values to be cleared properly when the user modifies the argument in the Inspector.
    • Removed the Parameter Constructors sub-menu because it isn't particularly useful now that actual constructors are supported.
     
  3. skytow2003

    skytow2003

    Joined:
    Feb 9, 2014
    Posts:
    18
    hi Kibernetik,
    your plugin is fantastic, it made my workflow much faster. I have used it "chaining" responses
    I wanted to know if there is a way to pause execution of event responses.
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    858
    I'm glad you like it.

    There isn't currently any way to pause execution. What exactly did you have in mind?
     
  5. skytow2003

    skytow2003

    Joined:
    Feb 9, 2014
    Posts:
    18
    Sorry, My question got cut off.
    I had added a brief example.
    With a Trigger 3d event from your build-in events I would chain a SetActive(false) response to deactivate a game object and then I would like to pause for x amount of time and then SetActive(true) to activate a second object.
    Instead of calling a specific method in a script that does this I wanted to know if it was possible to create a pause in the execution of the responses to the event.
    thanks in advance for your answer and again for the great plugin.
    Pietro
     
  6. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    858
    Yeah, that isn't currently possible. It's on my list of ideas I might try to add if I do any significant work on the plugin in the future, but that's not likely to happen any time soon.
     
  7. skytow2003

    skytow2003

    Joined:
    Feb 9, 2014
    Posts:
    18
    Ok, thanks anyways. Your plugin is already great as it is.
     
  8. Goat-Boy

    Goat-Boy

    Joined:
    Jun 15, 2015
    Posts:
    128
    @Kybernetik Hey, love your plugin, it has saved me a lot of suffering. Is there anyway to get Unity's button's to use UltEvents instead of UnityEvents? I poked around the docs but couldn't find anything on it.
     
  9. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    858
    Unfortunately that's not possible, but you could eiter:
     
    Goat-Boy likes this.
  10. unity_7PljJ4sqTncHsQ

    unity_7PljJ4sqTncHsQ

    Joined:
    Aug 7, 2019
    Posts:
    2
    I was wondering if you would support fields considering properties are supported as well. (Similar to UnityEvents)
    Also, do you have any plans of supporting multi-scene invocations?
     
  11. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    858
    UnityEvents don't support fields though. Supporting properties is easy because they are literally just methods in disguise, but adding support for fields would have a performance cost for everyone even if they don't use that feature so I decided against it.

    No plans, but I'm open to suggestions if it can be done without forcing a significant performance cost on all events. How would you envision such a feature working?
     
  12. Storm4_

    Storm4_

    Joined:
    Mar 2, 2016
    Posts:
    8
    Hi! UltEvents is so absolutely amazing I can't imagine Unity without it, but I'm wondering if you have thought about this feature.
    I want to use a return value from a previous call not as a parameter, but as a target of another call. This would allow for even less ugly scripts to be created. Or maybe I missed something and it's already possible somehow?
     
  13. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    858
    That's something I've got on my list of ideas to consider if I ever want to turn UltEvents into a proper visual scripting tool, but at this point it's unlikely to happen since I rarely even use UltEvents for anything more than simple function calls and I'm not a fan of visual scripting.
     
  14. Storm4_

    Storm4_

    Joined:
    Mar 2, 2016
    Posts:
    8
    Okay, and huge thanks for the work, I think your assets deserve to be a native part of Unity. Keep it up!
     
    Kybernetik likes this.
  15. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    858
    UltEvents v2.1 is now available on itch.io (should get approved on the Asset Store in a few days). Most of the changes are pretty minor bug fixes.
     
  16. imgodot

    imgodot

    Joined:
    Nov 29, 2013
    Posts:
    176
    Just started playing with UltEvents and, so far, I really like what I see; nice tool.

    I have a question, that I'm sure is obvious, but....
    I have a singleton in the scene, which contains my event to change the game status with an enum argument.
    When I instantiate a prefab programmatically, I want to add to the event on the singleton to trigger a method on the prefab. I have it working except that, I don't know how to set the argument as "linked".

    Here is the relevant code in my prefab script:
    Code (CSharp):
    1. var call2 = Singleton.Instance.GameStatusChange_Event.AddPersistentCall(
    2.            (System.Action<enTEST_ENUM>)OnStatusChange);
    When the prefab is instantiated, the event is added; I can see it in the inspector; but it is unlinked so the game status parameter does not get passed to the method on the prefab. If I activate the link button, then it all works as desired.

    Thanks for any help.
    -- Paul
     
  17. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    858
    If you are doing that at runtime, you don't need to use persistent calls or linked parameters at all. A dynamic listener could do it much easier:
    Code (CSharp):
    1. Singleton.Instance.GameStatusChange_Event.DynamicCalls += () =>
    2. {
    3.     OnStatusChange(Singleton.Instance.GameStatusOrWhatever);
    4. };
    Doing it in Edit Mode is not currently supported. You could need to add a method to the PersistentArgument class to set its type to PersistentArgumentType.Parameter as well as the other field values explained in the comment above that enum value. I vaguely remember there being an issue that prevented me from implementing such a method, but I can't remember what it was.
     
  18. imgodot

    imgodot

    Joined:
    Nov 29, 2013
    Posts:
    176
    Kyb,

    Thanks for the help. I got it working, but it took me awhile due to my ignorance with all but the simplest of lambda coding.

    Interesting side note: I could hook up an UltEvent to a prefab in the editor without the prefab even being in the scene.
    Further, the event method on the prefab gets triggered even without the prefab being instantiated!
    This works within Unity and in a built EXE.
    I don't know what use I would put this to, and it certainly is not sanctioned by the gods of Unity, but it is interesting.

    For posterity (note: The "dummy_argument" text can be anything you want. It is not a defined variable.)
    Code (CSharp):
    1.         My_Singleton.Instance.My_GameStatusChange_Event.DynamicCalls += (dummy_argument) => {
    2.             OnStatusChangeFromSingleton(dummy_argument);
    3.         };
    4.  
     
  19. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    858
    Assets are still objects that can have their methods called, fields accessed, etc. even if they aren't in the scene.

    A Material or ScriptableObject is an asset that will never exist in the scene, but you can still reference and use all their members, get their name, set colors, etc.

    A prefab is no different, it's just an asset and will never exist in the scene (only instantiated copies will) so it won't get Updates or collision messages or anything, but that doesn't stop it from being accessed.
     
  20. FabioZocklabs

    FabioZocklabs

    Joined:
    Jul 11, 2019
    Posts:
    5
    UltEvents is a great library, but there's one feature, that might be very useful, which seems not to exist.
    When you call a method, which takes at least one parameter, you can either specifiy the value yourself, or you can use an appropriate linked value, which is either an event parameter or the result of another computation.

    But as the Object, a method belongs to, you can only specify the parameter yourself, not use a linked parameter. It would be nice if this is possible.

    My current usecase is this: I have an `Attackable` class, and an attack event like this `class AttackEvent: UltEvent<Attackable>`. The attackable contains an attack event, but there's another class, which changes the attack event, so it does not have access to that object.
    Now if I want to use the other class to define an event, which destroys the gameObject of the attackable, it's applied to, it's not possible.

    My current workaround is using `UltEvent<Attackable, GameObject>`
     
  21. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    858
    Another workaround would be to make a static Destroy method that takes an Attackable so you can use an event to call it or a
    GameObject GetGameObject(Attackable)
    method so you can pass its returned value into Object.Destroy or whatever else you want.

    I briefly tried to implement the ability to call methods on linked parameters rather than only targeting specific Objects, but I wasn't able to come up with a reliable way to do it without notably decreasing performance for all other use cases as well so I decided against it.
     
unityunity