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

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:
    2,485
    I didn't get the error in 2022.3.0f1 but I do get it in the latest 2022.3.7f1 so it must have been newly introduced. The issue is that several of the GUIStyles UltEvents is trying to use don't seem to exist, which is probably the same as this issue.

    Hopefully they'll fix it soon, but for now you can avoid the issue by going to
    static InternalGUI()
    and replacing the first 3 lines with this:
    Code (CSharp):
    1. SearchBarStyle = EditorStyles.toolbarSearchField;// GUI.skin.FindStyle("ToolbarSeachTextField");
    2. SearchBarEndStyle = EditorStyles.toolbarButton;// GUI.skin.FindStyle("ToolbarSeachCancelButtonEmpty");
    3. SearchBarCancelStyle = EditorStyles.toolbarButton;// GUI.skin.FindStyle("ToolbarSeachCancelButton");
     
    MUGIK and echba11h like this.
  2. echba11h

    echba11h

    Joined:
    Sep 25, 2022
    Posts:
    4
    Wow! Thank you for your excellent response.
     
    hopeful likes this.
  3. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    449
    Or you can use this:
    Code (CSharp):
    1. SearchBarStyle = GUI.skin.FindStyle("ToolbarSearchTextField");
    2. SearchBarEndStyle = GUI.skin.FindStyle("ToolbarSearchCancelButtonEmpty");
    3. SearchBarCancelStyle = GUI.skin.FindStyle("ToolbarSearchCancelButton");
    Previously, there was a typo `Seach` instead of `Search`.
    This fixed issue for me.
     
    andreiagmu, hopeful and Kybernetik like this.
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,485
    Oh yeah, I totally forgot about that. When I first wrote it I noticed that typo in the names so they obviously didn't remove those styles, just fixed their old typo. Really annoying that they'd rename them in a minor patch version though, because it means I can't just use a #if to give the right name.
     
    andreiagmu, echba11h and hopeful like this.
  5. Solairen

    Solairen

    Joined:
    Feb 2, 2020
    Posts:
    2
    I encountered a problem, couldn't find a solution. When I drag a scriptable object into the event it works perfectly, but if I try to drag an object from the hierarchy it says "no type selected". I tried dragging the object itself, the specific attached script, and did it for every single object in the scene with the same result. Am I doing something wrong?
    upload_2023-9-8_23-3-0.png
     
  6. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,485
    Where is your event located? If it's in an asset then it won't be able to reference objects in the hierarchy because Unity doesn't allow assets to reference scene objects.
     
  7. Solairen

    Solairen

    Joined:
    Feb 2, 2020
    Posts:
    2
    Yes, this was indeed the case. Thank you.
     
  8. Walter_Hulsebos

    Walter_Hulsebos

    Joined:
    Aug 27, 2015
    Posts:
    26
    You can wrap it in a check if you want it to work with older versions of the engine as well:

    Code (CSharp):
    1.                 #if UNITY_2023_2_OR_NEWER || UNITY_2021_3_28 || UNITY_2022_3_1
    2.                 SearchBarStyle       = GUI.skin.FindStyle("ToolbarSearchTextField");
    3.                 SearchBarEndStyle    = GUI.skin.FindStyle("ToolbarSearchCancelButtonEmpty");
    4.                 SearchBarCancelStyle = GUI.skin.FindStyle("ToolbarSearchCancelButton");
    5.                 #else
    6.                 SearchBarStyle       = GUI.skin.FindStyle("ToolbarSeachTextField");
    7.                 SearchBarEndStyle    = GUI.skin.FindStyle("ToolbarSeachCancelButtonEmpty");
    8.                 SearchBarCancelStyle = GUI.skin.FindStyle("ToolbarSeachCancelButton");              
    9.                 #endif
     
  9. Mackerel_Sky

    Mackerel_Sky

    Joined:
    Jul 24, 2018
    Posts:
    7
    Hi there!

    I'm using UltEvents mainly for inputting multiple fields into my custom events. I'm wondering if it's possible to extend the code somehow so that I can pass in Lists?

    Thanks!
     
  10. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,485
    If you want to pass in the list from code when invoking the event, an UltEvent<T> lets you use whatever parameter type you want as T.

    Allowing you to set up a list in the event's Inspector wouldn't be feasible, but if you make a MonoBehaviour or ScriptableObject to hold your list, you could have the event take that object as a parameter.
     
  11. Mackerel_Sky

    Mackerel_Sky

    Joined:
    Jul 24, 2018
    Posts:
    7
    Hrmm, the list in the inspector was what I was after, but I understand how that could be difficult to implement. I'll go with a separate list container and reference that. Thanks for helping out!