Skip to content

Server lost ownership but OnGainedOwnership was triggered #2023

Closed
@gooddereklu

Description

@gooddereklu

Description

Hi! guys! I just upgrade to Netcode preview 9, and found a strange behaviour.

I had a network behaviour object that will switch ownership from server to client.

But the network behaviour on the server side will trigger OnGainedOwnership even when it lost owner from server.

This happen on Netcode preview 9 only.

I was using Netcode preview 5 before upgrading.

Reproduce Steps

1.Create Empty Unity Project
2.Donwload Netcode preview 9 package
3.Create a Script and inherit from Network Behaviour
4.Create a method with attribute like this : [ServerRpc (RequireOnwership = false)]
5.Within method from step4, I switch it's ownership by typing "GetComponent().ChangeOwnership( clientID )"
6.Create a override OnGainedOwnership method

Actual Outcome

Server side trigger OnOwnershipLost at first and OnGainedOwnership was trigger right after that.
Client side was fine.

Expected Outcome

After transport ownership from server to client, the client side should receive OnGainedOwnership, and server should only trigger OnLostOwnership

Screenshots

Environment

  • OS: Mac
  • Unity Version: 2021.3.1
  • Netcode Version: 1.0.0-pre.9

Metadata

Metadata

Labels

priority:lowThis issue has low priority and will take some time to be resolvedstat:importedStatus - Issue is tracked internally at Unity

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions