0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Photon FusionのIsSharedModeMasterClientは受け渡せない

Last updated at Posted at 2024-09-19

結論

IsSharedModeMasterClientを意図的に他のプレイヤーに受け渡すことができません。今後に期待です。

やりかったこと

IsSharedModeMasterClientの権限が無いと、ルームのCloseができません。ルームに入室している特定のグループだけがCloseするようにしたかったので、該当グループでないユーザがIsSharedModeMasterClientの権限を持ってしまった場合(例えば該当グループでないユーザ以外が全員退室した場合)、その後どこかのタイミングで受け渡したかった。

プログラム的には

NetworkRunnerにはSetMasterClientというメソッドがあるので一見できそうなのですが、このメソッドを呼んでも設定変更されません。

networkRunner.SetMasterClient(playerRef);

その他

/// 確認用に出したログ、NetworkBehaviourを継承しているクラスで出力できます。
/// よくわからなくなった時に見てみると権限周りで足りないものがわかるかもしれません。
private void CheckPropertyValues()
{
    Debug.Log($"HasInputAuthority = {HasInputAuthority}");
    Debug.Log($"HasStateAuthority = {HasStateAuthority}");

    Debug.Log($"Runner.IsClient = {Runner.IsClient}");
    Debug.Log($"Runner.IsPlayer = {Runner.IsPlayer}");
    Debug.Log($"Runner.IsServer = {Runner.IsServer}");
    Debug.Log($"Runner.IsSharedModeMasterClient = {Runner.IsSharedModeMasterClient}");

    Debug.Log($"Runner.IsResimulation = {Runner.IsResimulation}");
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?