All Projects → Siccity → Serializablecallback

Siccity / Serializablecallback

Licence: mit
UnityEvent and System.Func had a child

Projects that are alternatives of or similar to Serializablecallback

Undopro
UndoPro is a command-based undo system integrated into Unity's default system. This allows devs to use actions for their undo/redo operations without forcing the user into a new undo-workflow!
Stars: ✭ 107 (-40.56%)
Mutual labels:  callback, unity
Unitybarcodescanner
Simple Unity Barcode Scanner
Stars: ✭ 180 (+0%)
Mutual labels:  unity
Crest
An advanced ocean system implemented in Unity3D
Stars: ✭ 2,364 (+1213.33%)
Mutual labels:  unity
Raytracedhardshadow
DXR based raytraced hard shadow for Unity
Stars: ✭ 179 (-0.56%)
Mutual labels:  unity
Unity Easinglibraryvisualisation
Front end visualisation of 40 common easing equations.
Stars: ✭ 178 (-1.11%)
Mutual labels:  unity
Lwrpambientocclusion
Post-Processing Stack v2 Ambient Occlusion works on Lightweight Render Pipeline
Stars: ✭ 179 (-0.56%)
Mutual labels:  unity
Ssrt
Real-time indirect diffuse illuminaton using screen-space information for Unity.
Stars: ✭ 176 (-2.22%)
Mutual labels:  unity
Vfxpyro
Fireworks particle effect with Unity VFX Graph
Stars: ✭ 181 (+0.56%)
Mutual labels:  unity
Veranda
A graph editor framework for Unity
Stars: ✭ 180 (+0%)
Mutual labels:  unity
Geovfx
Examples of geographical data visualization with Unity VFX Graph
Stars: ✭ 179 (-0.56%)
Mutual labels:  unity
Customtoolbar
CustomToolbar
Stars: ✭ 178 (-1.11%)
Mutual labels:  unity
Behaviac
behaviac is a framework of the game AI development, and it also can be used as a rapid game prototype design tool. behaviac supports the behavior tree, finite state machine and hierarchical task network(BT, FSM, HTN)
Stars: ✭ 2,294 (+1174.44%)
Mutual labels:  unity
Unityheapexplorer
A Memory Profiler, Debugger and Analyzer for Unity 2019.3 and newer.
Stars: ✭ 179 (-0.56%)
Mutual labels:  unity
Kinovision
Frame visualization utility for Unity
Stars: ✭ 177 (-1.67%)
Mutual labels:  unity
Openbrushvr
Unity VR & AR Painting in 3d space for the Vive and Tango and ARKit
Stars: ✭ 180 (+0%)
Mutual labels:  unity
Bobbin
small Unity editor tool that can automatically download and import Google Docs or Sheets (or anything with a URL) into your Unity project; perfect for collaborating with designers, writers, or translators
Stars: ✭ 176 (-2.22%)
Mutual labels:  unity
Unityexplorer
An in-game explorer and a suite of debugging tools for IL2CPP and Mono Unity games, to aid with modding development.
Stars: ✭ 172 (-4.44%)
Mutual labels:  unity
Unity Aseprite Importer
An aseprite-file importer for unity written in C#, built upon the experimental AssetImporter API
Stars: ✭ 177 (-1.67%)
Mutual labels:  unity
Msbuildforunity
MSBuild integration in Unity
Stars: ✭ 181 (+0.56%)
Mutual labels:  unity
Kinobinary
Binary image effect for Unity
Stars: ✭ 180 (+0%)
Mutual labels:  unity

SerializableCallback

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

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<bool> {}

    // Last generic type parameter is the return type, staying consistent with System.Func
    [Serializable]
    public class GetProduct : SerializableCallback<int, MyProduct> {}
}
Performance (100000 iterations) Time
bool Method(float) 00.00304s
SerializedCallback<float, bool> (Persistent) 00.01026s
SerializedCallback<float, bool> (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 manifest.json:

"com.github.siccity.serializablecallback": "git+https://github.com/Siccity/SerializableCallback.git"

Join the Discord server to leave feedback or get support.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].