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. Dismiss Notice

Just Another Event System

Discussion in 'Assets and Asset Store' started by Deleted User, Feb 12, 2016.

  1. Deleted User

    Deleted User

    Guest

    Decouple and re-use your code with this high-performance and feature-packed event system!
    Simply code your methods in your favorite IDE and see them appear in the editor for you to invoke!

    Features:

    - Invoke methods...
    ...with Vector, Enum, Color, and Quaternion parameters!
    ...after a specified delay!
    ...with up to 4 parameters!
    ...with optional parameters!
    - Set fields, properties, and methods!
    - Easily reorder event listeners with drag & drop!
    - Debug your project with exposed runtime listeners!
    - Get the return value of fields, properties and methods!
    - Emulate C# 4.0's dynamic with the Variant class!
    - Fully commented source code included!
    - And more!

    Get it now on the Asset Store or from our website!
















     
    Last edited by a moderator: May 13, 2016
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,194
    Looks great! We'll probably pick this up as it hits the Asset Store.

    Is there any reason for the 4-parameter limit? It'd be nice to be able to use arbitrary methods.

    You should probably put the price somewhere on your website - it feels kinda clunky to have to click the "buy now" button before you get to know the price.
     
    Deleted User likes this.
  3. Deleted User

    Deleted User

    Guest

    Hey Baste,

    Thanks for your feedback. :D
    I've worked on the website all weekend so it should look a lot nicer now!
    The reason for the 4 parameter limit is because I've only created generic types with up to 4 arguments.
    That's the only reason, really.
    How many parameters were you hoping to use? 4 is a lot already! :p
    I will put it on my to-do list for the next version. It won't be very hard to implement so if it's an important feature to you, let me know and I'll add it ASAP!
     
  4. Deleted User

    Deleted User

    Guest

    Hey guys let me know what features you're hoping for in future versions!
    Some things I have in mind:

    - support for generic methods
    - support for generic methods with type constraints
    - support for static methods

    Personally I have no need for any of those so not sure sure if you guys need these features either.
     
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,194
    Both generics and static methods would be a huge improvement.

    The number of parameters is just a nice thing to have - but if it's easy to see where the code needs to be modified to add support for more, that's not too big of a deal.

    By the way - are method overloads handled? And default parameters?
     
  6. Deleted User

    Deleted User

    Guest

    Right now my list of potential features looks like this (in no particular order):

    - support for generic methods
    - support for generic methods with type constraints
    - support for static methods
    - invoke a delegate with a time delay
    - platform-dependent calling of delegates
    - support for methods with up to 16 parameters, just like the standard System.Action & System.Func.

    I'll explore every feature and see how beneficial they would be to implement versus their trade-offs.
    The last one on the list, like I said before, is very easy to add just a bit tedious is all. I'll implement it for v1.05.
    Right now I'm working on v1.04 which will have major performance improvements for the property drawers.

    To answer your question, yes method overloads are properly supported and so are methods with optional parameters.
    Default parameter values are not respected and the end-user will have to manually set any optional arguments in the editor. So for example if you have this method:

    Code (CSharp):
    1. public void DoStuff(int x = 5){
    2.     // Do stuff...
    3. }
    That method is supported and can be invoked but when you select it in the editor, x will be set to 0. You can then set x to whatever you want, of course.
    I don't see any problems on top off my head from initializing optional parameters with their default values, but I don't see much potential benefits from such a feature either. I'll add it to the list but it will be at the bottom for the time being.

    Methods with params arguments are not supported. I may explore this feature in the future.
     
    Baste likes this.
  7. Deleted User

    Deleted User

    Guest

    If anyone is interested in purchasing the asset but is put-off by it not being on the asset store, shoot me a message and I'll send you the package for free! If you like it, you can pay me the price it's selling for ($25) and post a good review in this thread :D. If not, let me know what you don't like and how I can fix it!
     
    Last edited by a moderator: Mar 7, 2016
  8. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hello,
    I have tried the package (thanks Rafael) and I find it useful.
    No errors, functional, waiting for the asset store launch !

    P.s. If you have more than one class in your project, you can benefit from this package.
     
  9. Deleted User

    Deleted User

    Guest

    I'm very excited to say that as of last week, this package was approved on the Asset Store! :D

    You can now get it from the Asset Store or as always, from our website.

    I'm slow to post but I've been working hard on improving the system. I've just submitted v1.03 to Asset Store for review.
    It includes minor editor bug fixes and runtime performance improvements, but more importantly, you can now invoke event listeners after a specified delay!

    This is what it looks like:

     
  10. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,624
    (Wrong link for asset store here and in first post.)

    Congrats! :)
     
  11. Deleted User

    Deleted User

    Guest

    Oops!

    Thanks for noticing! :p
     
  12. k234234w

    k234234w

    Joined:
    Sep 8, 2013
    Posts:
    8
    Hi, purchased this asset today (5/4/2017), was wondering how to get this to work with custom types. I could do it myself if you tell me which files to look at and point me in the right direction.
     
  13. k234234w

    k234234w

    Joined:
    Sep 8, 2013
    Posts:
    8
    I think everything would be fine for me if I could send scriptable objects. For testing i have a scriptable object called TowerData, which just has a string property. I can then do this

    [Serializable]
    public class TestObjectEvent : SerializableEvent<TowerData>
    {
    }

    Now in the inspector I can assign the receiver and select dynamic TowerData, so if i have a stored TowerData I can recieve that. However, I want to be able to assign the TowerData in the inspector, but the non dynamic version is not visible.

    My reciever just has this
    public void TestObjectRecieving(TowerData data)
    {
    Debug.Log("In TestObjectRecieving, towers name = " + data.Name);
    }

    Does anyone know how i can see the non dynamic version for scriptableobject/object.
     
  14. k234234w

    k234234w

    Joined:
    Sep 8, 2013
    Posts:
    8
    I got it working by replacing Variant IsSupported with this.

    public static bool IsSupported(Type type)
    {
    for (int i = 0; i < SupportedTypes.Count; i++)
    {
    Type supportedType = SupportedTypes;
    if (supportedType.IsAssignableFrom(type))
    {
    return true;
    }
    }
    return false;
    }
     
  15. k234234w

    k234234w

    Joined:
    Sep 8, 2013
    Posts:
    8
    If anyone else needs this package working outside of the editor remove any variables otuside of #if UNITY_EDITOR pre-processor checks, that will invovle SerializableEvent.cs, and SerializableDelegate.cs, for example

    #pragma warning disable 0414
    [SerializeField, HideInInspector] private string _typeName;
    #pragma warning restore 0414

    should not be within a UNITY_EDITOR check, or your build will crash.