From d22a42cc6640312edb6f977b461b68dc3d01d7bd Mon Sep 17 00:00:00 2001 From: Hannah Giovanna Dawson Date: Mon, 23 May 2022 04:50:34 +0100 Subject: [PATCH] RequestSerialization should be virtual RequestSerialization is technically a built-in, but there's no reason to prevent extension by developers (or warn against it, depending on the IDE). An example of this usecase is the common pattern of calling `RequestSerialization()` and then `OnDeserialization()`. By extending `RequestSerialization` we can declare that we always will call `OnDeserialization` afterwards, reducing boilerplate. Other examples: if we would like to update an atomic clock by one whenever we call RequestSerialization, or we might want to automate assigning ownership. --- Packages/com.vrchat.UdonSharp/Runtime/UdonSharpBehaviour.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.vrchat.UdonSharp/Runtime/UdonSharpBehaviour.cs b/Packages/com.vrchat.UdonSharp/Runtime/UdonSharpBehaviour.cs index 5ff5a0e7..787d24ba 100644 --- a/Packages/com.vrchat.UdonSharp/Runtime/UdonSharpBehaviour.cs +++ b/Packages/com.vrchat.UdonSharp/Runtime/UdonSharpBehaviour.cs @@ -145,7 +145,7 @@ protected static GameObject VRCInstantiate(GameObject original) /// This will only function if the UdonSharpBehaviour is set to Manual sync mode and the person calling RequestSerialization() is the owner of the object. /// [PublicAPI] - public void RequestSerialization() { } + public virtual void RequestSerialization() { } // Stubs for builtin UdonSharp methods to get type info private static long GetUdonTypeID(System.Type type)