프로젝트
GitHub에서 보기
Siccity/SerializableCallback
소개
UnityEvent and System.Func had a child
게임 및 에뮬레이션측정된 스타 증가
- in 24h
- -1
- in 7 days
- -2
- in 15 days
- -2
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalSerializableCallback
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

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.
관련 프로젝트 살펴보기
불러오는 중…