Change Callback
For Properties
You can have a method get called whenever a networked property changes, which is very useful. To do that, add the attribute [OnChanged]
to the method and give it the name of the property. The method must have one parameter of the same type of the property which would contain its previous value.
Example:
For Arrays
If you have an array and want a callback for when an element changes, you can do so as follows:
Example:
The difference here to a variable property is that the callback method must have an index parameter that points to the changed element.
Last updated
Was this helpful?