LogoLogo
HomeOnline DashboardAPIDiscordForums
SDK 0.4.14
SDK 0.4.14
  • Welcome
  • Overview
    • What is coherence?
    • How does coherence work?
    • Features and Roadmap
    • Requirements
  • Get Started
    • Install coherence
    • Scene setup
    • Prefab setup
    • Build and run
    • Baking and code generation
    • Create a free account
    • Deploy and share
  • Authority and communication
    • How authority works
    • Authority transfer
    • Commands
    • Server-side and input queues
    • Animations
  • Persistence
    • Overview
    • Configuring persistence
    • Storage
    • Example – A global counter
  • Optimization
    • Overview
    • Simulation frequency
    • Areas of interest
    • World size
    • Level of detail
    • Interpolation
    • Extrapolation
  • Connected entities
    • Overview
    • Entity references
    • ConnectedEntity component
    • Parent-child relationships
  • Simulators
    • Overview
    • Client vs. simulator logic
    • Build and deploy
    • Simulator load balancing
  • 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. Network Events
  • Game Services
    • Game account
    • Key-value store
    • Matchmaking
  • API reference
    • Network SDK
      • CoherenceSync
      • MonoBridge
      • LiveQuery
      • Archetype
      • Sample UI
      • Settings Window
    • Cloud API
      • API tokens and keys
      • Server discovery
      • Game account
      • Key-value store
      • Matchmaking
    • Replication Server
    • Simulation Server
    • Entity Component System
      • Network Entities and Components
  • Schema reference
    • Overview
    • Specification
    • Field Settings
    • Archetypes and LOD-ing
  • Resources
    • Downloads
    • Video Tutorials
    • Glossary
    • CLI Utilities
    • Helper Scripts
    • Troubleshooting
  • Community
    • Discord
  • Additional information
    • Pricing
    • SLA
    • Unreal Engine support
    • Peer-to-Peer (P2P)
    • Known Issues
    • Version History
Powered by GitBook
On this page
  • Sending Network Events
  • General Set Up
  • In This Scene...
  • Build and Try

Was this helpful?

Export as PDF
  1. Tutorial project
  2. Start Tutorial

7. Network Events

Last updated 4 years ago

Was this helpful?

Sending Network Events

This scene will show you how easy it is to set up Networking in your Unity project and send Network Events to other clients. Network Commands is like sending a direct message to another player, without anyone else knowing. Network Events is like shouting out loud for anyone in the area to hear you.

In this example each client has one character they can control with click to move input. They can right-click anywhere on the grid and all entities will instantiate an exclamation mark above their head.

General Set Up

In the Hierarchy of the Scene you can see three core Prefabs:

Coherence Entity is the prefab that will change per Scene with different functionality. It has a standard CharacterControllerand Rigidbody as well as an Agent script which will handle movement functionality through the Input Manager in the Core Scene Setup prefab.

In This Scene...

Network Events are still in development but this example shows a workaround using Commands. When an event is sent to an entity, Coherence Handler finds all instances of coherenceSync and sends the event command to all these entities.

In the coherenceSync component, small "lightning bolt" icons are shown next to the tick boxes for the syncable properties. These icons signify that they are public methods rather than singular variables and that these methods can be called through the Coherence Handler Event System, either to send or receive commands.

In the game view in Play mode, Commands can be sent to other entities via the right click button anywhere on the grid and an exclamation mark asset should pop up above all clients entities.

Build and Try

You can build this Scene via the Build Settings. Run the local Replication Server through the Window -> Coherence -> Settings window and see how it works. You can try running multiple clients rather than just two and see replicating for each.

Core Scene Setup and Coherence Setup are present in all scenes and described in detail in .

Exploring the Network Playground