Delegates doesn't work well with prefab modifictaions.

Issue #332 new
Bjarke Elias created an issue
public class SomeComponent : SerializedMonoBehaviour
{
    public CustomEvent<UnityEngine.Object> test;
}

[InlineProperty(LabelWidth = 50)]
public struct CustomEvent<T>
{
    [SerializeField]
    private T arg1;

    [SerializeField, HideLabel]
    private Action<T> action;

    [Button]
    public void Invoke()
    {
        if (this.action != null)
        {
            this.action(this.arg1);
        }
    }
}

Comments (0)

  1. Log in to comment