Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Upgrading the project results in missing system.serializable UnityEvent function

Discussion in '2019.3 Beta' started by Metron, Jan 8, 2020.

  1. Metron

    Metron

    Joined:
    Aug 24, 2009
    Posts:
    1,137
    This is still an issue with the latest 2019.3.03f...

    This does not show up in the inspector:

    Code (CSharp):
    1. public class TextUnityEvent : UnityEvent<string>
    2.     {
    3.     }
    Then in the class itself

    Code (CSharp):
    1. public TextUnityEvent onErrorEvent;

    Neither does this (directly in the behaviour class):
    Code (CSharp):
    1. public UnityEvent<string> OnLoginError;
    It has been several months... what are you doing???
     
  2. UnityLiudas

    UnityLiudas

    Unity Technologies

    Joined:
    Feb 15, 2018
    Posts:
    1
    Hey Metron,

    After some investigation around these issues, it seems that your described problem is a different bug and the bug that you've originally linked is fixed:
    https://issuetracker.unity3d.com/product/unity/issues/guid/1196591/

    Could you please submit a bug report with a project and some sort of reproduction steps I could follow?

    When reporting a bug, make sure to either provide this forum page link in the bug report description or post the generated case id on this forum page.
     
    LeonhardP likes this.
  3. Metron

    Metron

    Joined:
    Aug 24, 2009
    Posts:
    1,137
    Hi,

    @liudas_unity : I submitted a bug:

    (Case 1210355) UnityEvents with parameters do not show in Inspector

    Thanks for looking at this.
     
    LeonhardP likes this.
  4. Metron

    Metron

    Joined:
    Aug 24, 2009
    Posts:
    1,137
    Ok... so QA came back to me and it seems that the first part can be solved like this:

    Code (CSharp):
    1. [Serializable]
    2. public class TextUnityEvent : UnityEvent<string>
    3. {
    4. }
    The [Serializable] should do the trick.

    For the remaining parts, it should be integrated into 2020.1... Hoping for a backport...
     
  5. TextusGames

    TextusGames

    Joined:
    Dec 8, 2016
    Posts:
    429
    1. As far as I know that then you create a new class that you want to be shown in editor you must add serializable attribute to it. So that is not a trick this is expected.

    2. Fields of generic type (Like UnityEvent<string>) was never serialized in unity before. They could be serialized in 2020.1 but you will need to add [SerializedReference] attribute on field.