PUN Classic (v1)、PUN 2 和 Bolt 處於維護模式。 PUN 2 將支援 Unity 2019 至 2022,但不會添加新功能。 當然,您所有的 PUN & Bolt 專案可以用已知性能繼續運行使用。 對於任何即將開始或新的專案:請切換到 Photon Fusion 或 Quantum。

Entity Ownership

Ownership of entities (game objects with a Bolt Entity component attached) is broken down into two separate categories: Owner and Controller.
They are not mutually exclusive, you can be any of the following:

  • Owner
  • Controller
  • Owner and Controller
  • Neither

Owner

Being an Owner is a non-changeable property that is assigned to the peer which the BoltNetwork.Instantiate call is issued on.
This peer is the only one where BoltEntity.isOwner will return true. Ownership of an entity can not be transferred to anyone else.
The owner of an entity has absolute control over everything (state, transform, etc.).

Controller

Being a Controller of an entity is something which can be assigned, taken away and transferred to other peers.
Only the Owner can assign and take away the control of an entity.

The Owner can assign control of an entity to another peer by calling BoltEntity.AssignControl(otherConnection); and passing in the connection to the other peer.
Control can also be removed by calling BoltEntity.RevokeControl().
This peer will now be considered the Controller of this entity.

The Owner can also take control of an entity himself, he will then be considered both the Owner and Controller.
Taking control of an entity you are the Owner of is done by calling BoltEntity.TakeControl and releasing control is done with BoltEntity.ReleaseControl.

The Controller is the only one that the BoltEntity.hasControl property will return true on.

Neither

If you are neither the Owner or Controller of an entity, both BoltEntity.isOwner and BoltEntity.hasControl will return false.
In general you can't do very much with the entity in question and it's usually something you don't have any control of in the game (like another players avatar for example).

Back to top