Search Unity

Custom UI Event System revamped

Discussion in 'Scripting' started by lermy3d, Sep 8, 2015.

  1. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Hi everyone, there is a really good thread about Unity Events and the guys there were discussing about the current event Unity v5.x system limitations.

    Current Unity Event System limitations:
    -Nonexistent way for re-arrange events execution order.
    -Methods with multiple parameter values are not supported.
    -Methods with default parameter values are not supported.
    -VectorX as a parameter is not supported.
    -Color as a parameter is not supported.

    I think UnityEvents are on the right path but the way they are now are currently too simple, at least inspector wise, and for me this is a big thing.

    This is why I decided to start making my own custom version of a UI event system based on previous implementations and I wanted to share it with the community. You can download the latest version from the Asset Store here: Event Delegate System.

    There is also a GitHub repo for the Event Delegate System if you want to dive in the code and help improving this out.

    Event Delegate System features:
    -Easy way for reordering events, like a drag and drop kind style!
    -Unlimited parameters.
    -Support for properties and fields.
    -Supporting usage of methods from Components and GameObjects.
    -Support for static methods and methods with return values.
    -Support for methods with default parameters values.
    -Support for Enum, Enum Flags, Vector2, Vector3, Vector4 and Color as parameters.
    -Parameter mode, you can setup either a value or a reference.
    -Allow folding the entire event list for visualization clarity.

    Easy to use!:


    Code (CSharp):
    1. using UIEventDelegate;
    2.  
    3. public class EventTest : MonoBehaviour
    4. {
    5.     public ReorderableEventList OnEnableEvents;
    6.  
    7.     void OnEnable()
    8.     {
    9.         if (OnEnableEvents.List.Count > 0)
    10.             EventDelegate.Execute(OnEnableEvents.List);
    11.     }
    12. }
    Event Display:

    events display - 578x548.png

    Method menu selection:


    fields and properties display 632x696.png

    Current Version

    v12.3
    -Refresh rate optimization added for delegates visualization. (thanks to Froghuto)

    v12.2
    -Added option to visualize enums as flags.
    -Bug fixes.

    v12.1
    -Adding the ability to refresh a target component's functions manually. (request from QuantumCalzone)
    -Using toggle on label click for easier fold-out (request from Jay-Pavlina)
    -Allow folding the entire event list for visualization clarity.
    -Improving check for Unity version. Adding support for Unity 2017 or newer versions.

    v12
    -Support for properties and fields.
    -Supporting usage of methods from Components and GameObjects.
    -Improved list height calculation.
    -Private methods are not being showed anymore.
    -Removing indent level of parameters below method.
    -Avoiding the use of foreach instructions to avoid heap allocations that will eventually trigger the garbage collector. Also loops micro improvements implemented.
    -Minor code cleanup.

    v11
    -Allow the use of flags with enum types.
    -Added ability to change a method while in Play mode and thus enabling tests without stopping gameplay. Previously it was using the first executed method saved in cache.
    -EventDelegate drawer optimizations. Just asking once for the use of Parameter mode (Value or Reference) per parameter.
    -Parameters are not requested again only if in editor mode (for testing purpose) or if the parameter is a reference. We assume value parameters will never change in the realtime deployed app.
    -Added missing error log in case a method invoke failed when no arguments expected.
    -Some minor code cleanup.

    v10.1
    -Issue affecting methods using void template as return type is now solved.

    v10
    -Reoderable feature implemented. Easy way for reordering events, like a drag and drop kind style!
    -Enum support implemented.
    -Parameter mode, you can setup either a value or a reference. You can now select any property to be a reference from a GameObject or using a manual value in the inspector.
    -Issues calculating height fixed. Added offset option for overlap issue in reorderable event list.
    -Fixed fold group indent level.

    v9
    -Support for Vector2, Vector3, Vector4 and Color as parameters.
    -EventDelegate added to UIEventDelegate namespace to avoid name collision.
    -Adding a "<Missing - 'previous method name'>" when method was not found.
    -Improved memory usage and performance when drawing events by avoiding the creation of a new EventDelegate object per draw, only for confirming existence. Now only one is created at startup.
    -Fixed issue for components with some specific return value types.

    Known issue:
    -When Inspector width is below a very small threshold the Vector2 and Vector3 attributes will get drawn below their respective lines.

    v8
    -Support for non-public and static methods.
    -Overloaded methods are now correctly filtered.

    v7
    -Support for methods with return values.
    -Showing previous name method when used method has gone missing, like: <Missing - MethodName>.
    -Parameters removed for selected method. We only show the name of the selected method since parameters are already been shown, and it clears the event display quite a bit.

    v6
    -Support for methods with multiple and default parameters values.
    -Methods are displayed sorted and showing parameter type and name.

    Future improvements:
    -Add an easy built in method to add or remove events via scripts. Helpful for building EventDelegates during runtime.
    -Add the ability to refresh a target component's functions manually.
    -Allow folding the entire event list for visualization clarity.
    -Create "Examples" scene.
    -Support for overloaded methods.
    -Support for generic methods. (Beware that currently generics methods are not being filtered)
    -Memory footprint optimization using lordofduct 'parameter class' implementation as reference.
    -Allow to distinguish between different components in the same GameObject.

    I deeply hope that this goes as a starting point in the interest to point out Unity how important would be to support this in the UI system, having this features shipping with Unity would be the ideal case!

    Please let me now any suggestion, feature request or pizza donations be my guest! :)

    You can also send some pizza donations here:
    https://paypal.me/lermy3d/5

    Best regards,
    Lermy
     
    Last edited: Aug 6, 2018
  2. Spoke44

    Spoke44

    Joined:
    Feb 16, 2015
    Posts:
    11
    Thank you for this, I'll try your script and give you a feedback :)
     
    lermy3d likes this.
  3. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Hi everyone, I just posted a EventDelegate v7! Here are the changes:

    -Support for methods with return values.
    -Showing previous name method when used method has gone missing, like: <Missing - MethodName>.
    -Parameters removed for selected method. We only show the name of the selected method since parameters are already been shown, and it clears the event display quite a bit.

    I updated the original post as well with screenshots and the package.

    Hit me back for any issue or suggestions!

    Have a nice one!
    Lermy
     
  4. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Hi everyone, I just posted a EventDelegate v8! Here are the changes:

    -Support for non-public and static methods.
    -Overloaded methods are now correctly filtered.

    Do not be shy people, you can hit me back for any issue or suggestions!

    Have a nice one!
    Lermy
     
    Last edited: Sep 15, 2015
  5. Deleted User

    Deleted User

    Guest

    I'll have to try that. :p
     
    lermy3d likes this.
  6. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    You should throw this up in a version control repo somewhere. Bitbucket and GitHub are both good ones. This lets people both contribute and use the code more easily.
     
    lordofduct and lermy3d like this.
  7. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Thanks BoredMormon, great suggestion! I will definitely do it and post you guys back the link.
     
  8. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,528
    Yeah, I haven't looked at it once yet just for that reason.

    I just look at the 'unitypackage' and grumble... "ugh, I have to download, create an empty unity project, import, open in visual studio, and then look at this?"
     
    lermy3d likes this.
  9. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Hello eveyrone! I just created a repo in github so anyone willing to help or improve the Event System is more than welcome!!
     
  10. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    Will this work on all of Unity's platforms? I'm specifically wondering about iOS and WebGL.

    I'm also wondering if this will work with any serializable type.
     
    Last edited: Oct 3, 2015
    lermy3d likes this.
  11. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101

    Hi Jay, as far as I am concerned the reflection namespace is supported across all platforms that uses Mono, leaving Window Store and Windows Phone unsupported for the moment since they use their own .Net classes and I haven't had the chance to test them on those just yet, :confused:... :)

    Regarding your concern about serializable types, the answer is yes it will work.

    Make as many tests as you wish and If you have any issues please let us know!
     
    Last edited: Oct 3, 2015
  12. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    Last edited: Oct 3, 2015
    lermy3d likes this.
  13. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    I see, I was not including NetworkBehaviour on the development project, thanks a lot for the tip. Great it worked like a charm for you, if you have any suggestion or issue do not hesitate to post.

    Have a nice one.
     
  14. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Hi guys I just updated the post with a new version bringing some new parameter support and some cool optimizations and fixes. The master branch on the github repo is also updated for those who are interested in the code or making a contribution.

    Here are the new features:

    -Support for Vector2, Vector3, Vector4 and Color as parameters.
    -EventDelegate added to UIEventDelegate namespace to avoid name collision.
    -Adding a "<Missing - 'previous method name'>" when method was not found.
    -Improved memory usage and performance when drawing events by avoiding the creation of a new EventDelegate object per draw, only for confirming existence. Now only one is created at startup.
    -Fixed issue for components with some specific return value types.

    Leave your comment, issue or suggestion!
    Have a nice one.
    Lermy
     
  15. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @lermy3d I really like your Event System. The only issue I have with it is that I wish somehow visually the events stood out more in the inspector. When I'm looking down the inspector of a component with multiple variables sometimes it's easy to get lost in the variables, where with Unity's event system they have that separate design to events which immediately draws my eye for me to realize they are events. If you could somehow mirror that or have an inspector UI interface that stood out more I think that would really help. Keep up the great work.
     
    lermy3d likes this.
  16. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Hello BearFish, thank you so much for leaving a comment on the thread. I totally think this should be done, I was actually working on getting the re-orderable feature to be ready since this will solve both issues in a row. I have tried using rotorz reorderable list due to all the advantages it provides but I haven't been able to make it work just yet.

    So do not worry, is in the ToDo list and this is definitely a must have, I just haven't been able to make it work.

    For those who want to help on these feature there is a develop branch on the repo if anyone would like to give a hand with that too.

    Thanks again, and I'll keep you posted.
     
    Last edited: Oct 6, 2015
  17. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    I liked before that I could pass a Vector2 parameter as a property of an object. Can you make it so that you can either enter a value manually or send a property of an object (like it was before)? This would be extremely powerful.
     
    lermy3d likes this.
  18. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    I see what you mean, let's see if I can add an option for drawing a manual value or setting up a reference. I will add it in the ToDo list. Thanks for the suggestion.
     
    Jay-Pavlina likes this.
  19. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,528
    If you want, check out my 'VariantReference' class:
    https://github.com/lordofduct/space...lob/master/SpacepuppyBase/VariantReference.cs

    It's a bit like your 'Parameter' class, but it packs into a much smaller memory foot print, and has support for pulling properties from existing properties. As well as an ability to evaluate simple arithmetic operations that include properties of objects.

    The property reading is done via my 'dynamic' namespace:
    https://github.com/lordofduct/space...lob/master/SpacepuppyBase/Dynamic/IDynamic.cs
     
    Last edited: Oct 7, 2015
    lermy3d and Jay-Pavlina like this.
  20. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    I did notice EventDelegate was serializing a lot of data. I like your solution.
     
  21. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Thanks lordofduct, nice for sharing your code for reference on that. Is definitely a better organized code compared with the one I started off.

    I will give a deeper look on that and let you know. Thanks :)
     
  22. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Hello guys!

    I just wanted to let you know that there is a new version of the Event Delegate System available!! Version 10 is here with a lot of the awaited features! Without further ado here are the new changes:

    Event Delegate System v10 features:

    -Reoderable feature implemented. Easy way for reordering events, like a drag and drop kind style!
    -Enum support implemented.
    -Parameter mode, you can setup either a value or a reference. You can now select any property to be a reference from a GameObject or using a manual value in the inspector.
    -Issues calculating height fixed. Added offset option for overlap issue in reorderable event list.
    -Fixed fold group indent level.

    Sorry for the long wait, I have been busy with a lot of work but I am pretty happy to be back with many of this exciting new features. Hope the community find this really useful.

    Cheers!
     
    Last edited: Feb 22, 2016
    FuguFirecracker likes this.
  23. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    I changed the enum part of EventDelegateDrawer.cs so that it works with flags. This is what I did, if you're curious.
    Code (CSharp):
    1. else if (useManualValue && param.expectedType.IsEnum) {
    2.     SerializedProperty valueProp = paramProp.FindPropertyRelative("argIntValue");
    3.  
    4.     if (param.expectedType.GetAttribute<System.FlagsAttribute>() != null) {
    5.         param.value = EditorGUI.MaskField(lineRect, new GUIContent(paramDesc), valueProp.intValue, Enum.GetNames(param.expectedType));
    6.         valueProp.intValue = (int)param.value;
    7.     }
    8.     else {
    9.         Enum selectedOpt = (Enum)Enum.ToObject(param.expectedType, valueProp.intValue);
    10.           param.value = EditorGUI.EnumPopup(lineRect, new GUIContent(paramDesc), selectedOpt);
    11.         valueProp.intValue = (int)param.value;
    12.     }
    13.  
    14. }
    15.  
    16. public static T GetAttribute<T>(this MemberInfo memberInfo) where T : Attribute {
    17.     return memberInfo.GetCustomAttributes(typeof(T), true).FirstOrDefault() as T;
    18. }
    19.  
    Also, I was wondering why you were using a string to represent the enum. Any reason you were using that instead of an int?
     
    lermy3d and Malbers like this.
  24. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    :rolleyes: This is awesome! I am adding this new feature now. Thanks for the improvement!!

    Yes there was :D , my first intention was to use int, but I didn't find nor knew we could have used 'Enum.ToObject' as in your snippet code. Now we can use int to store enums!! I really appreciate this hint.

    I was also interested in adding the optimization shared here from lordofduct so I will keep you guys posted on that optimizations.

    Many thanks again for the contribution Jay!
    Best regards
     
    Last edited: Apr 28, 2016
    Jay-Pavlina likes this.
  25. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    A bit offtopic but how did you manage getting different heights for each element?
     
    lermy3d likes this.
  26. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    You can take a look at the code in the public repo here, specifically there is a script called ReorderableDelegateDrawer.cs, you can check the line 48, what I'm doing is assigning a callback that gets called when the list is calculating an item height, and that is basically it. I will leave you a snippet here:

    Code (CSharp):
    1. const int lineHeight = 18;
    2.  
    3. private UnityEditorInternal.ReorderableList list;
    4.  
    5. private UnityEditorInternal.ReorderableList getList(SerializedProperty property)
    6. {
    7.     if (list == null)
    8.     {
    9.         list = new ReorderableList(property.serializedObject, property, true, true, true, true);
    10.  
    11.         list.elementHeightCallback = (index) =>
    12.         {
    13.             float lines = 0;
    14.          
    15.             //calculate how many lines you need for the received item in var 'index'
    16.          
    17.             return lines * lineHeight;
    18.         };
    19.      
    20.     }
    21.  
    22.      return list;
    23. }
    Notice that in that script there is also a method called GetPropertyHeight that is being overridden to return the height of the property and is there where we are calling for the height of the entire list and our callback gets called for each element in the list.

    Hope this helps in what you are doing :)
    Cheers!
     
    Last edited: May 3, 2016
    Nefisto and Malbers like this.
  27. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Thanks,
    I guess I should have thought of that too, the solution is simpler than I anticipated.
     
    lermy3d likes this.
  28. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Do not punish yourself, haha, the thing is that this was not possible before, I do not really know in which version this came out since it is an undocumented feature.

    I actually found it on a blog when searching for this, a blog that I already had read before and originally they didn't had this part included but a guy leave it in a commentary and the author included it in the blog. You can check the article here, take a look at the end of the blog.
     
    Last edited: May 3, 2016
    hopeful likes this.
  29. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    I actually used that article to make my own, I guess i have skipped over some stuff. But it's good to know it's possible. Now that i've taken a good look at the last part, not sure why I missed that. Thanks.
     
    lermy3d likes this.
  30. mrEagle

    mrEagle

    Joined:
    Jun 22, 2015
    Posts:
    2
    Hey There!

    You got me excited enough to start posting on this forum, your work looks like it may save me a ton of work.
    One thing I was hoping to find in your system is something that I have not been able to achieve in the standard event system yet either. That is:

    Suppose that I have a simple component with some functionality that depends on some public parameters like:

    {code}
    public class Spawner : MonoBehaviour {

    public GameObject monster;

    void Spawn(){
    Debug.Log (gameObject.name + " wants to spawn " + monster.name);
    }
    }
    {code}

    I would like to have multiple of these components on a single game object (a spawnpoint) and be able to trigger events that call the Spawn method of a particular behaviour. Your property drawer correctly identifies multiple methods, but all groups them under a single tab in the dropdown for the component Spawner and always calls the method from the same component.

    E.g. if I have a gameobject SpawnPoint with two Spawner components, one given a game object MonsterA and the other given a MonsterB prefab, the print statement will either always read "SpawnPoint wants to spawn MonsterA" or always "SpawnPoint wants to spawn MonsterB". I used the snippet that you provided:

    1. using UIEventDelegate;

    2. public class EventTest : MonoBehaviour
    3. {
    4. public ReorderableEventList OnEnableEvents;

    5. void OnEnable()
    6. {
    7. if (OnEnableEvents.List.Count > 0)
    8. EventDelegate.Execute(OnEnableEvents.List);
    9. }
    10. }
    and added two elements in the list by dragging the spawner components into their respective slots.

    Apart from moving all Spawner components into a child object I have no good solutions, but this will grow out of hand.
    Note that arguments for the method will not do me well either as there will be external factors acting on the public monster to tweak things. (And spawning isn't my only use case for this feature :))

    Hope the question is welcome, and thanks again for the work you did and saved me!
     
    lermy3d likes this.
  31. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Hello mrEagle!

    Many thanks for all your motivation and good vibe! :)

    I was also curious that the original EventSystem in Unity does not allows this o_O. The tricky thing here is that we may need a map with a way to unequivocally identify a component in the GameObject so we can give a differentiation treatment in the system to call the right method. Other than that I dont't see why not to have this feature included!

    I will added to ToDo list and any suggestion is very welcome! :p

    Have a nice one!
    Lermy
     
  32. mrEagle

    mrEagle

    Joined:
    Jun 22, 2015
    Posts:
    2
    Awesome :)

    I'm not too deep into C# yet, as I'm developping on embedded c++ mostly, but it seems to me that 'Instance ID' and 'Local Identifier In File' of script components could be a user friendly way to go. Together with the (for me unfamiliar) reflection tools I guess it should be pretty doable.

    How about this little tester script as a starter. (I haven't dived completely into your code yet, but it's pretty comprehensible :))

    Cheers!

    PS. Excuse the unformatted code, I'm getting there -- slowly...

    using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;
    using System.Reflection;

    public class MethodLister : MonoBehaviour {
    [ContextMenu("List public method names")]
    void ListPublicMethods(){
    // seems to keep track of the order displayed in the inspector
    MonoBehaviour[] mblist = GetComponents<MonoBehaviour> ();

    List<string> names = new List<string>();

    // get all the interesting methods
    for (int i = 0; i < mblist.Length; i++) {
    MethodInfo[] methods = mblist.GetType().GetMethods();

    for (int j = 0; j < methods.Length; j++) {
    string name = methods [j].Name;

    // remove unnecessary methods
    if(ignoremethods.Contains(name))
    continue;

    bool cont = false;
    foreach (string ign in ignoremethodsstartingwith) {
    if (name.StartsWith (ign)) {
    cont = true;
    break;
    }
    }
    if (cont)
    continue;

    // unique identifier to be logged:
    names.Add (gameObject.name + "/" + mblist .GetType().Name + " (" + mblist .GetInstanceID() + ")/" + name);
    }
    }

    // log all the interesting methods
    for (int h = 0; h < names.Count; h++) {
    Debug.Log (names [h]);
    }
    }

    List<string> ignoremethods = new List<string>{
    "obj_address",
    "MemberwiseClone",
    "Finalize",
    "Invoke",
    "InvokeRepeating",
    "CancelInvoke",
    "BroadcastMessage",
    "Equals",
    "CompareTag",
    "ToString",
    "GetType",
    "GetHashCode",
    "GetInstanceID"
    };
    List<string> ignoremethodsstartingwith = new List<string>{
    "StartCoroutine",
    "StopCoroutine",
    //"StopAllCoroutines",
    "set_",
    "get_",
    "GetComponent",
    "SendMessage"
    };
    }
     
    lermy3d likes this.
  33. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Hello guys!

    We have a new update with some nice improvements on version 11!! Leaving the features made here so far. The hardest ones are coming next so hang on for those. ;)

    Event Delegate System v11 features:

    -Allow the use of flags with enum types.
    -Added ability to change a method while in Play mode and thus enabling tests without stopping gameplay. Previously it was using the first executed method saved in cache.
    -EventDelegate drawer optimizations. Just asking once for the use of Parameter mode (Value or Reference) per parameter.
    -Parameters are not requested again only if in editor mode (for testing purpose) or if the parameter is a reference. We assume value parameters will never change in the realtime deployed app.
    -Added missing error log in case a method invoke failed when no arguments expected.
    -Some minor code cleanup.

    Best regards everyone!
     
    Hodgson_SDAS likes this.
  34. Game-Seeker-Atlas

    Game-Seeker-Atlas

    Joined:
    Aug 13, 2014
    Posts:
    2
    I was searching just for fold-able unity events and found this, simply amazing.
    This brings both NGUI delegates and UnityEvents good ways together and adds much more functions.
    I think unity developers should add your system to engine, even %50 of these will be good :)
    Is it possible to collapse from white area at to top? It would be good too.
    Thanks for all :)
     
    lermy3d and hopeful like this.
  35. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    :rolleyes: Thank you for all the kind words Game-Seeker-Atlas! I deeply appreciate you find this useful! ;)
    Let´s hope the guys in Unity include something of this... one day. I think they have other priorities, that's all.
    Regarding your request, I will have to check if the ReorderableList component allows me to include a fold in the top most section, at the moment I am only drawing per item basis for that implementation, but if that's so it should be pretty straightforward.

    Thanks again! and enjoy!!
     
  36. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    @ lermy3d
    many many thx... but for me it's too late...
    i gave up on this long ago...
    UNITY3D don't listen to long time customers... they only care now about shareholders value ;-)
    respect that you made a great system for the event stuff...
    well a small demo scene and a few demo scrips would be a great addition to start with that!
    Normally i don't talk much on these forums anymore because Unity people don't listen to problems...
    I lost some job's because of the bad bad performance on Mobile Devices of Unity3d v5.1.x
    but well just want to thank you for the great work!
    lots of great people had leave the Unity3d train because of the issues that they don't listen ...
    I use it only now for small projects where performance on Mobile is not important...
    still so many bug's...
    anyway keep the great work up & maybe provide a demo scene to help people to get start...
    I had totally forgotten the Unity Event System because of too many problems... still
    M.
     
    leni8ec and lermy3d like this.
  37. Hodgson_SDAS

    Hodgson_SDAS

    Joined:
    Apr 30, 2015
    Posts:
    123
    @lermy3d Cool stuff! Thank you for sharing this.
     
    lermy3d likes this.
  38. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
  39. Game-Seeker-Atlas

    Game-Seeker-Atlas

    Joined:
    Aug 13, 2014
    Posts:
    2
    Can't target functions if they have same name with different arguments :(

    Code (CSharp):
    1.         public void TargetFunction(int value)
    2.         {
    3.         }
    4.  
    5.         public void TargetFunction(string value)
    6.         {
    7.         }
     
  40. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Yes indeed @Game-Seeker-Atlas, that is correct, is in the Future improvement section in the first post as:

    Future improvements
    -Support for overloaded methods.

    sorry for it is too long... ;)
     
    Last edited: Oct 13, 2016
  41. MichaelNielsenDev

    MichaelNielsenDev

    Joined:
    Apr 17, 2014
    Posts:
    10
    Hey, this is exactly the kind of thing I've been looking for! Thank you for doing the work of making this!

    Is there any better in depth tutorials on how to use this though? I'm not sure what to input in the inspector interface to set up triggers for the events.
     
    lermy3d likes this.
  42. vermei

    vermei

    Joined:
    Jun 8, 2016
    Posts:
    3
    This is pretty legit. Thanks so much for sharing.
     
    lermy3d likes this.
  43. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Thanks man! Sorry since I have not made any tutorial whatsoever... :rolleyes::D Maybe some introductory video would suffice. Anyways enjoy!

    You are very welcome! I hope you enjoy it!!
     
  44. vermei

    vermei

    Joined:
    Jun 8, 2016
    Posts:
    3
    Im having trouble compiling. It works fine in play mode but when I try to compile it gives me a bunch of namespace errors.
    The type or namespace name `UnityEditor' could not be found. Are you missing an assembly reference?
     
    lermy3d likes this.
  45. Malbers

    Malbers

    Joined:
    Aug 7, 2015
    Posts:
    2,558
    everything that using UnityEditor must be in a Editor folder, otherwise you will get that error, some script you have with that name space, is not a Editor folder
     
    lermy3d and vermei like this.
  46. vermei

    vermei

    Joined:
    Jun 8, 2016
    Posts:
    3
    Thanks, that was the problem.
     
    lermy3d and Malbers like this.
  47. TextusGames

    TextusGames

    Joined:
    Dec 8, 2016
    Posts:
    429
    Hi, you could also add the ability to Set public Fields.

    As for me you should not increase indent level of properties and name each delegate element as assigned method.

    wqe.png

    p. s. I was not able to remove extra height of each element of the reorderable list but I wanted.
     
    lermy3d likes this.
  48. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    Hello TextusGames, what version are you using? Did you already try version 11?
    You can already pass public field as a reference since version 10. :D

    This is a nice hint. I would like to find a solution so the user can still name the action as they wanted to if they wish.

    Let me know if you could use the reference feature with your scripts. ;)
     
  49. TextusGames

    TextusGames

    Joined:
    Dec 8, 2016
    Posts:
    429


    I was talking about ability to set any public field of target component (not passing it through parameter)
    (like Playmaker does it, you can, for example, call general construction SET_PROPERTY_OF: SpriteRenderer ( Color) ) (you have already done getting field and passing them through parameters but not setting)

    And one more thing. Why can I access private methods? I think it is a very bad idea to allow using private methods, the one's which were made inaccessible by design. (I strongly recommend to not show private methods in inspector)

    wqe.png

    You have made a good thing. it is sad so that unity team don't do such simple things by themselves (in UnityEvent)

    I think I will not risk relying on the third party extentions that allow serialized calls (even if I do I will choose Playmaker over any other (you can find inspiration on this point there too (look at small elegant button at the end of parameter field, it is reference/value switch))),

    I wish you best luck in creating the superb alternative to UnityEvents.
     
    lermy3d likes this.
  50. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    That is nice! Thank you!!