SerializableCallback icon indicating copy to clipboard operation
SerializableCallback copied to clipboard

How to check null?

Open alijaya opened this issue 3 years ago • 1 comments

How to check if the function is not set up?

alijaya avatar Dec 11 '22 11:12 alijaya

I also wish to know that. If I try to get a result of a callback that has no listeners yet, I get

IndexOutOfRangeException: Index was outside the bounds of the array. InvokableCallback2[T0,TReturn].Invoke (System.Object[] args) (at ./Library/PackageCache/com.github.siccity.serializablecallback@7ff19f1223/Runtime/InvokableCallback.cs:38) SerializableCallback2[T0,TReturn].Invoke (T0 arg0) (at ./Library/PackageCache/com.github.siccity.serializablecallback@7ff19f1223/Runtime/SerializableCallback.cs:37)

And I can't see a way to check it. Did you find a solution @alijaya ?

[Edit:] Anyways, it should always be fixable by putting a try block around it, even if it's not a nice workaround.

BadToxic avatar Mar 12 '25 20:03 BadToxic