Alex
Alex

Reputation: 319

Unity3D: UnityEvent with inputs does not appear in editor

Does anyone know how make complex UnityEvent appear in editor?

public class Test : MonoBehaviour
{
    public UnityEvent myEvent;
    public UnityEvent<string> myAnotherEvent;
}

myEvent appears just fine, but myAnotherEvent does not.

Thanks in advance.

UPD Also tried to override the UnityEvent like:

public class NewEvent : UnityEvent<string>
{
}

public class Test : MonoBehaviour
{
    public UnityEvent myEvent;
    public NewEvent myAnotherEvent;
}

didn't seem to help.

Upvotes: 1

Views: 131

Answers (1)

Everts
Everts

Reputation: 10701

[System.Serializable]
public class NewEvent : UnityEvent<string>
{
}

public class Test : MonoBehaviour
{
    public NewEvent myAnotherEvent;
}

You need to inform that your new class is serializable.

Upvotes: 1

Related Questions