Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for non value types. #6

Open
fscigliano opened this issue Dec 1, 2018 · 1 comment
Open

Support for non value types. #6

fscigliano opened this issue Dec 1, 2018 · 1 comment

Comments

@fscigliano
Copy link

fscigliano commented Dec 1, 2018

UnityEvent has support for common serialized types not inherited from UnityEngine.Object. By debugging the code, it seems that SerializableCallback has a validation method for parameters that checks if they are a value type and inherits from UnityEngine.Object, and returns invalid if they not.
So for feature parity with UnityEvent, SerializableCallback should support these custom types.

Example:
Add this Component to a GameObject, and try to select the dynamic method TestMethod from both the UnityEvent and the SerializableEvent. Only the UnityEvent will provide the option.

using UnityEngine;
using UnityEngine.Events;

public class TestCallbackReceiver : MonoBehaviour {

    [System.Serializable]
    public class TestClass
    {
        public int a;
        public int b;
    }
    [System.Serializable] public class TestUnityEvent: UnityEvent<TestClass, bool, bool> {}
    [System.Serializable] public class TestSerializableCallback: SerializableEvent<TestClass, bool, bool> {}

    public TestUnityEvent testEvent;
    public TestSerializableCallback testSerializableCallback;

    public void TestMethod(TestClass a, bool b, bool c)
    {
        Debug.Log("only detected by UnityEvent");
    }
}
mnicolas94 added a commit to mnicolas94/SerializableCallback that referenced this issue Sep 12, 2023
@mnicolas94
Copy link

I added this feature here. You can use my fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants