PUN Classic (v1), PUN 2 and Bolt are in maintenance mode. PUN 2 will support Unity 2019 to 2022, but no new features will be added. Of course all your PUN & Bolt projects will continue to work and run with the known performance in the future. For any upcoming or new projects: please switch to Photon Fusion or 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