Version: 2017.1

NetworkIdentity.AssignClientAuthority

Switch to Manual
public bool AssignClientAuthority (Networking.NetworkConnection conn);

Parameters

conn The connection of the client to assign authority to.

Returns

bool True if authority was assigned.

Description

This assigns control of an object to a client via the client's NetworkConnection.

This causes hasAuthority to be set on the client that owns the object, and NetworkBehaviour.OnStartAuthority will be called on that client. This object then will be in the NetworkConnection.clientOwnedObjects list for the connection.

Authority can be removed with RemoveClientAuthority. Only one client can own an object at any time. Only NetworkIdentities with localPlayerAuthority set can have client authority assigned. This does not need to be called for player objects, as their authority is setup automatically.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961