S&box Wiki

Network Callbacks

Network Callbacks

You can get a notification when a [Net] property has changed clientside. This is useful if you want to update something in the UI, or run some other logic when the variable changes on the client without having to poll for changes frequently.

Simply add the [Change] attribute alongside your [Net] property, by default this calls On[PropertyName]Changed.

[Net, Change] public string DataString { get; set; } public void OnDataStringChanged( string oldValue, string newValue ) { Log.Info( $"changed from {oldValue} to {newValue}" ); }
[Net, Change( nameof( DoSomething ) )] public string DataString { get; set; } public void DoSomething( string oldValue, string newValue ) { Log.Info( $"changed from {oldValue} to {newValue}" ); }

Special Pages


Wikis

?

Render Time: 52ms

DB GetPage 41
Generate Html 1
SaveChanges (1) 7
Render Body 0
Render Sidebar 1