fix: Weaver Generated Cmd/Rpc should be private (#2799)

* Fix for users calling weaver gen'd methods in the inspector

Forces the new weaver generated method to be private, preventing prevents users from mistakenly calling weaver generated methods in dropdown menus (such as buttons) in the inspector.

* Update Assets/Mirror/Editor/Weaver/Processors/MethodProcessor.cs

Co-authored-by: vis2k <info@noobtuts.com>
This commit is contained in:
Cooper H 2021-06-25 13:45:47 -04:00 committed by GitHub
parent 5528bdd27e
commit 74ae04d222
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,6 +35,12 @@ public static MethodDefinition SubstituteMethod(TypeDefinition td, MethodDefinit
string newName = RpcPrefix + md.Name;
MethodDefinition cmd = new MethodDefinition(newName, md.Attributes, md.ReturnType);
// force new usercode_cmd to be private.
// otherwise the generated User_Cmd could be assigned to UnityEvents in the Inspector
// (User_Cmd() is only called by Invoke_Cmd in this class)
cmd.IsPublic = false;
cmd.IsPrivate = true;
// add parameters
foreach (ParameterDefinition pd in md.Parameters)
{