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

IEntityReplicationFilter

IEntityReplicationFilter lets you determine whether the entity should replicate to the specific connection.

C#

public class EnemyController : Bolt.EntityEventListener<IEnemyTest>, Bolt.IEntityReplicationFilter
{
    /**
     * Filters out any package to be 
     * sent to a target connection
     * @param  connection Target player connection
     * @return            True if the target connection should 
     *                    receive updates from this entity
     */
    public bool AllowReplicationTo(BoltConnection connection)
    {
        return (myDistance < 1000f);
    }
}
Back to top