Syncing Xevious enemies with MLAPI

The basic synchronisation

Network Object Component

Transformation Synchronisation

Network Transform.
Basic Sync demo

Pooling Objects

Object Pooling
  1. The handler only fires on the Client. I admit this confused for me for a while.
  2. The RegisterSpawnHandler does NOT have any concept of type. Therefore when you RegisterSpawnHandler is invoked you have no idea what prefab it has been invoked for. Therefore writing a single delegate to handle all the calls for any pooled object type is not possible. MLAPI wants you to have a pool per object, rather than a pool that can manage multiple objects. Therefore in the above code I am using closures to create a delegate per pooled object type, the prefab name is captured locally before the above snippet.
Pooled Demo

Animations and Fly-ins

Network Animator Component
gameObject.SetActive(false);
gameObject.transform.position += Vector3.up * 100f;
Final Demo

Where next?

  • the enemy bullets — should these still be just sync’ed tranforms & animations?
  • basic ground targets. — ground targets must be a child of the scrolling background and must move using local rather than world position.

--

--

--

Unity, VR, Enterprise and .Net Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Using generative art to create a pulsating SVG star

Launching HTML5 Games In The ARK Desktop Wallet — Part Four

Streaming Images from MongoDB using Golang

gRPC and gRPC Reflection

Should I prioritize my content?

How to Publish Your Spring Boot App to the Cloud

Create High Availability architecture with AWS CLI with 99.999999% uptime

Document Python Functions with Dostrings

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Paul Marsh

Paul Marsh

Unity, VR, Enterprise and .Net Developer

More from Medium

This can be Your Template for a Main-Menu Scene in Unity

Animating Sprites in Unity

Depth with Unity TileMaps

Creating objects in Unity