Is there an Example for Spawning Predicted Ghosts and using MarkPredictedGhosts?

In my exploration of the DOTS Sample project, I am attempting to modify the weapon by making it fire a projectile (like a rocket). The NetCode docs say:

“You can extend the entity-specific spawning by implementing a partial class of the same name as the generated spawn class. You can call the MarkPredictedGhosts function so that you can assign a specific ID for that type of prediction. This method must contain user defined logic to match a ghost from the server with a predicted spawned local entity.”

Is there an example of this someone can point me to? I am guessing this is not actually that complicated but without a little more info I’m uncertain how to accomplish this.

This feels like the kind of thing that once someone points me at the right thing I’m going to feel dumb for having had to ask. :slight_smile:

The doco says:
To override the default client instantiation you can create a partial class with the same name as the ghost spawner and implement MarkPredictedGhosts.

The NetCode sample project implements this here: https://github.com/Unity-Technologies/multiplayer/blob/master/sampleproject/Assets/Samples/Asteroids/Client/BulletGhostSpawnSystem.cs

1 Like

Thanks, Maverick - I had not found that and it is very relevant.

1 Like