NetworkCommons
Namespace: SynicSugar.P2P
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public sealed class NetworkCommonsAttribute : Attribute
Description
For around game system.
NetworkCommons has no UserID. Instead, this has isHost flag in class. All peers can call a process in this class to synchronize with other peers.
SyncVar in Commons can specify isOnlyHost to synchronize only host values. This manages game time and enemy appearances. It may be better to manage the HP of bosses in CommonsClass than in PlayerClass, which has its each UserId.
Unlike PlayerClass that register Instance to ConnectHub with seteting UserId, NetworkCommons need be registered by hand. We can use RegisterInstance to register the instance.
If pass true, ConnectHub has GetUserInstance
Constructor
API | description |
---|---|
NetworkCommons() | useGetInstance's default value is false |
NetworkCommons(bool useGetInstance) | To use ConnectHub.Instance.GetUserInstance |
using SynicSugar.P2P;
[NetworkCommons(false)]
public partial class NetworkSample {
}