Unity-Technologies / Unity-Technologies/com.unity.netcode.gameobjects

ClientRpc and ServerRpc decorators should give an error if attached to a non-NetworkBehaviour class method

オープン
#1,911 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Tracking type:feature
主要言語
C#
スター
2.3k
フォーク
461
平均マージ
3日 16時間
マージ済み PR(30日)
20

説明

Is your feature request related to a problem? Please describe.
I'm finding it easy to accidentally add [ClientRpc] or [ServerRpc] methods to MonoBehaviour-derived classes, where clearly they won't do anything. This leads to a bunch of confusion while I try to figure out what's wrong with the networking only to do the forehead-slap when I notice that the class hasn't been switched to NetworkBehaviour.

Describe the solution you'd like
At a minimum, a runtime error with a descriptive error message would be helpful. Something like "FooClientRpc was added to a class that doesn't derive from NetworkBehaviour - as a result, FooClientRpc will never be called."

Better would be a similar error logged when in the editor. Compile-time errors would be ideal if possible, of course.

Describe alternatives you've considered
Beyond "vigilance" (which can be assumed doesn't work), if it becomes a more serious issue then I'd have to rig some sort of linting rule to catch this.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Issue ではファイル、テスト、エントリポイントが指定されていません。まず ClientRpc および ServerRpc デコレーターの処理と、NetworkBehaviour の継承がどのようにチェックされているかを特定します。NetworkBehaviour を継承していないクラスのメソッドに対する診断を定義してテストし、要求されているランタイムまたはエディターでの動作も含めます。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp
領域
networking
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。