MerlinVR / UdonSharp

An experimental compiler for compiling C# to Udon assembly
MIT License
678 stars 89 forks source link

Add an [Networked(<targets>)] attribute #35

Open orels1 opened 4 years ago

orels1 commented 4 years ago

Feature Description: As a continuation of this it would be nice to have some sort of [Networked] attribute to use in your U# code. This will mean that we can use a C#-like style of invoking events while still keeping them networked, as right now we have to use SendCustomNetworkEvent.

Additional context: Examples of usage would be


[Networked] // Target implicitly set to All
public void Bonk() {}

[Networked(All)] // Target explicitly set to All
public void Bonk() {}

Since we can define parameters for U# methods, this will also need to check for those and drop an error if you're trying to define a networked method with a parameter. But I think its a fair tradeoff for nicer code style and better refactoring support.

MerlinVR commented 4 years ago

This is mostly waiting on VRC to better define what they are going to be doing with network events for what targets they'll be able to have, if/how they'll support parameters, how or if network events will be protected from "malicious" events sent by modified clients, etc.

owlboy commented 4 years ago

how or if network events will be protected from "malicious" events sent by modified clients, etc.

🙏