Skip to content

IsOwner is false on clients for player objects during OnNetworkSpawn() #2189

@dsaunder

Description

@dsaunder

Description

Any update on this? I updated to Netcode v1.0.1 and IsOwner is false for my player objects during OnNetworkSpawn(). I've got a workaround for the few instances that I currently use this, but it's error prone and adds some complexity.

Reproduce Steps

  1. Create a new NetworkBehavior
  2. Override OnNetworkSpawn() with something like:
    public override void OnNetworkSpawn()
    {
    base.OnNetworkSpawn();
    Debug.Log($"IsOwner: {IsOwner}");
    }
  3. Create a prefab with the new NetworkBehavior script
  4. Make that prefab the default PlayerObject
  5. Start a host, observe the output of the OnNetworkSpawn() debug log line.
  6. Start a client, observe the output of the OnNetworkSpawn() debug log line.

Actual Outcome

The client log line is: "IsOwner: false"

Expected Outcome

The client log line is: "IsOwner: true"

Screenshots

N/A

Environment

  • OS: Windows 10
  • Unity Version: 2021.2.16f
  • Netcode Version: 1.0.1
  • Netcode Commit: [e.g. https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/commit/ba418fa5b600ad9eb61fab0575f12fbecc2c6520]

Additional Context

This looks like a possible regression as IsOwner used to be set correctly during OnNetworkSpawn().

Metadata

Metadata

Labels

type:supportQuestions or other support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions