I have a problem for a few days that didn’t exist before: UnityEvent no longer manages parameters. At first I thought it was related to the Unity version because I updated to 2019.3b, even returning in 2019.2.5f1 the problem exists.
This issue is already fixed in 2020.1.0a5, 2019.3.0b4 and above. Also, there is a backport opened for a review for 2019.2 stream. To work around this issue, you’ll have to upgrade to specified versions or above, or use 2019.2.4f1, since the regression was indeed introduced in 2019.2.5f1
This issue is not fixed in 2019.3.0b7, I’ve tested. So, I have to downgrade my project to 2019.2.4f1 (which I’ve tested and worked in a new test project) to make it work? I tried that, but doesn’t work for a variety of errors.
This completely destroyed the architeture of my project. Don’t say it was fixed in 2019.3.0b4 and above, because it’s simply not true.
using UnityEngine;
using UnityEngine.Events;
/*
UnityVersion: 2019.2.17
Bug Description:
Incorrect property-drawer is used for templated private fields in serializable classes.
*/
public class BugExample : MonoBehaviour
{
[SerializeField] private DerivedEventContainer container;
}
[System.Serializable]
public class DerivedEvent : UnityEvent<string> {}
public abstract class EventContainer<TEvent>
{
[SerializeField] private TEvent derivedEventBug;
[SerializeField] public TEvent derivedEventWorks;
}
[System.Serializable]
public class DerivedEventContainer : EventContainer<DerivedEvent>
{
[SerializeField] private DerivedEvent derivedEventAlsoWorks;
}
Change PlayerInput component’s Behavior to “Send Messages”
In your custom class that is attached to the same GameObject as the PlayerInput component, add “On” before each action’s respective method and make sure to pass InputValue value as a parameter
Ex:
Action is called “Move”. Custom class has a method with a header that looks like: public void OnMove(InputValue value)