LogoLogo
⚠️ Outdated documentationGo to LatestHomeAPI
SDK 0.9
SDK 0.9
  • Welcome
  • Overview
    • What is coherence?
    • How does coherence work?
    • Features and Roadmap
    • Rooms and Worlds
    • Requirements
    • Release Notes
  • Get Started
    • Install coherence
    • Scene setup
    • Prefab setup
    • Baking and code generation
    • Build and run
    • Create a free account
    • Deploy Replication Server
    • Share builds
    • Troubleshooting
  • Authority and communication
    • How authority works
    • Authority transfer
    • Commands
    • Simulation frame
    • Client connections
    • Server-authoritative setup
    • GGPO
    • Animations
    • Value sync callbacks
  • Persistence
    • Overview
    • Configuring persistence
    • Storage
    • Example – a global counter
  • Optimization
    • Overview
    • Simulation frequency
    • Areas of interest
    • Level of detail
    • Interpolation
  • Connected entities
    • Overview
    • Entity references
    • Parent-child relationships
    • CoherenceNode
  • Simulators
    • Overview
    • Client vs Simulator logic
    • Build and deploy
    • Simulator load balancing
    • Room Simulators
    • Multi-Room Simulators (advanced)
    • World Simulators
    • Simulator slugs
    • Testing Simulators locally
  • Tutorial project
    • Get the Tutorial Project
    • Start Tutorial
      • 1. Transforms
      • 2. Physics
      • 3. Persistence
      • 4. Animation and variables
      • 5. AI navigation
      • 6. Network commands
      • 7. Team-based
      • 8. Connected Entities
  • Game Services
    • Game account
    • Key-value store
    • Matchmaking
  • Developer Portal
    • Overview
    • Dashboard
    • Enabling game services
    • Configure Rooms
    • Manage Worlds
  • API reference
    • coherence SDK
      • CoherenceSync
      • MonoBridge
      • LiveQuery
      • Level of detail
      • Sample UI
      • Settings window
      • Custom bindings (advanced)
      • PlayResolver
      • Rooms
      • Worlds
    • Cloud API
      • API tokens and keys
      • Game account
      • Key-value store
      • Matchmaking
    • Replication Server
    • Simulation Server
  • Schema reference
    • Overview
    • Specification
    • Field settings
    • Archetypes in schemas
  • Resources
    • Downloads
    • SDK update guide
    • Video tutorials
    • Order of execution
    • Glossary
    • CLI utilities
    • Simulator CLI arguments
    • Helper scripts
    • Troubleshooting
    • Continuous Integration setup
  • Community
    • Community
  • Additional information
    • Pricing
    • SLA
    • Unreal Engine support
    • WebGL
    • Peer-to-Peer (P2P)
Powered by GitBook
On this page
  • LiveQuery
  • Adding a LiveQuery to the scene
  • Moving a LiveQuery
  • Adding a TagQuery

Was this helpful?

Export as PDF
  1. Optimization

Areas of interest

Last updated 2 years ago

Was this helpful?

LiveQuery

The way you get information about the world is through LiveQueries. We set criteria for what part of the world we are interested in at each given moment. That way, the Replicator won’t send information about everything that is going on in the Game World everywhere, at all times.

Instead, we will just get information about what’s within a certain area, kind of like moving a torch to look around in a dark cave.

More complex area of interest types are coming in future versions of coherence.

Adding a LiveQuery to the scene

A LiveQuery is a cube that defines the area of interest in a particular part of the World. It is defined by its position and its extent (half the side of the cube). There can be multiple LiveQueries in a single scene.

Moving a LiveQuery

A classic approach is to put a LiveQuery on the camera and set the extent to correspond to the far clipping plane or visibility distance.

Moving the GameObject containing the LiveQuery will also notify the Replication Server that the query for that particular Game Client has moved.

Adding a TagQuery

In addition to the LiveQuery, coherence also supports filtering objects by tag. This is useful when you have some special objects that should always be visible regardless of World position.

To create a TagQuery, right click a GameObject in the scene and select coherence > TagQuery from the context menu.

All networked GameObjects with matching tags will now be visible to the Client. The coherence tag can be any string and can be configured separately from the Unity tag in the Advanced Settings section of the CoherenceSync component.

Tags and TagQueries can be updated at any time while the application is running, either from the Unity inspector or setting CoherenceSync.coherenceTag and CoherenceTagQuery.coherenceTag with code.

Currently, only a single tag per GameObject and TagQuery is supported. To include objects with different tags, you can create multiple TagQuery objects for each tag.

In the future, we plan to integrate TagQueries with LiveQueries allowing combined query restrictions, e.g., only show objects with tag "red" within an extent of 50.

Queries can also be used for cheat prevention, see for more information.

Server authoritative setup