Skip to content

Misleading ILPP error message when [Rpc] is used inside a local function #3715

@GitUser187

Description

@GitUser187

Description

When I put the [Rpc] attribute on top of a local function (for example, inside the Update function), this error message appears: "Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP: Assets\Scripts\Script.cs(x,x): error - Rpc method must end with 'Rpc' suffix!". This is quite confusing as the function does in fact end with the Rpc suffix. It seems the ILPP is checking the compiler-generated name for local functions (like g__SomethingRpc|0_0), which no longer ends with "Rpc"

Reproduce Steps

  1. Create a NetworkBehaviour class
  2. Inside Update(), define a local function named SomethingRpc
  3. Add the [Rpc] attribute
  4. Let it compile
  5. Observe the confusing error message

Expected Outcome

A more concise error message which specifies that you mustn't have Rpcs be local functions or just the ability to have Rpcs be local functions

Environment

NGO 2.5.0

Metadata

Metadata

Labels

stat:InvestigatingIssue is currently being investigatedstat:awaiting-responseAwaiting response from author. This label should be added manually.stat:importStatus - Issue is going to be saved internallytype:bugBug Reporttype:docsDocs feedback or issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions