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

Global/Per-Prefab Query Options

Whenever Bolt attaches a prefab (either due to instantiation on the client/server or a rescope on the client), it needs to query for three components: IEntityBehaviour, IPriorityCalculator, and IEntityReplicationFilter. IEntityBehaviour is familiar to most users of Bolt as this is what EntityBehaviour<TState> implements. The other two are described in the documentation and rarely used by users.

Bolt allows multiples of each to exist. By default Bolt will perform a GetComponentsInChildren<T> on your entity for each of these types to find them during Attach(). Since this has to walk the entity’s children it is not necessarily the most performant option and it allocates some memory as well.

You can change the query behaviour globally for each of these interfaces in Bolt Settings, to either none, getComponent(), getComponents(), and getComponentsInChildren(). In addition, if you wish to override a prefab’s setting so that it is different than the global setting, you can do it in the entity’s setting on the prefab (the prefab will default to UseGlobal).

For most users of Bolt, IEntityBehaviour should be GetComponent() as they will have one IEntityBehaviour implemented class. IPriorityCalculator and IEntityReplicationFilter should be none as users usually don’t implement these (if you do, choose the appropriate setting for your scenario which is probably GetComponent).

Back to top