Need help with SerializableCallback?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

209 Stars 32 Forks MIT License 39 Commits 6 Opened issues


UnityEvent and System.Func had a child

Services available


Need anything else?

Contributors list

# 36,232
20 commits
# 159,156
3 commits


Lets you drag-and-drop methods with or without return values / parameters in the Unity inspector. It uses expression trees and reflection to cache a delegate on first execution.

Usage is identical to UnityEvent

unity_inspector ```csharp public class MyClass : MonoBehaviour { //These fields are shown in the inspector public SerializableCallback callback; // supports all non-void return types public Condition condition; // supports bool return types only public GetProduct getProduct; // supports MyProduct return types only

void Start() {
    // Callbacks can be invoked with or without parameters, and with different types
    Debug.Log(callback.Invoke()); // returns object
    Debug.Log(condition.Invoke()); // returns bool
    Debug.Log(getProduct.Invoke(2)); // returns MyProduct

// As with UnityEvents, custom callbacks must have a non-generic wrapper class marked as [Serializable] in order to be serialized by Unity [Serializable] public class Condition : SerializableCallback {}

// Last generic type parameter is the return type, staying consistent with System.Func [Serializable] public class GetProduct : SerializableCallback {}

} ```

| Performance (100000 iterations) | Time | | -------------------------------------------- | --------- | | bool Method(float) | 00.00304s | | SerializedCallback (Persistent) | 00.01026s | | SerializedCallback (Dynamic) | 00.00797s |

Installing with Unity Package Manager

To install this project as a dependency using the Unity Package Manager, add the following line to your project's

"com.github.siccity.serializablecallback": "git+"

Join the Discord server to leave feedback or get support.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.