Player Name (Sample UI)
How to network the Player Name set in the Connection Dialog?
Last updated
How to network the Player Name set in the Connection Dialog?
Last updated
coherence ships with a Sample UI that can be used to kickstart your project.
One implementation that we often see pretty early on prototypes, is the ability to show a name to identify players within a game session. So we've created a component to help achieve that: CoherencePlayerName
.
If you want to network the Player Name set on the Sample UI, add a CoherencePlayerName component to your CoherenceSync:
It will automatically bind its variable playerName
, since internally it uses the [Sync] attribute. So you're already set. At runtime, CoherencePlayerName.playerName
will hold the name of the player that owns that entity.
This component is only valid for the built-in Sample UI. You can, at any time, develop your own mechanism of storing and synchronizing a player name. This component is a convenience for early prototyping.