Add NetworkCalling.CalledBehaviour that contains the UdonBehaviour component reference that a network call was made against
techanon
We already have NetworkCalling.CallingPlayer, I think we should also be able to know which script is currently the entry point for a network call.
This will enable defensive guarding against network calls in event methods without requiring the _ prefix. Not requesting a legacy change, just an extra data point to handle logic with. Semantically this would probably be more valuable for U# devs, but equally useful for UGraph devs too.
This is how I would use it:
public void MyNetworkProtectedAPIEvent() {
// Guard against being called directly via SendCustomNetworkEvent
if (NetworkCalling.InNetworkCall && NetworkCalling.CalledBehaviour == this) return;
// beyond this, code continues as normal
}
This would enable making the method protected against _direct_ network calls, BUT still allows OTHER scripts to call the public API from _within their own network called scripts_.
This effectively replicates the _ prefix conditions, but allowing for more proper C# naming convention at the cost of 3-4 additional externs.
I imagine there are a few other uses such a data point would enable, but I haven't brainstormed that far just yet.
Log In