Fish-Net: Networking Evolved
  • Introduction
    • Getting Started
    • Showcase
      • Upcoming Releases
    • Legal Restrictions
    • Pro, Projects, and Support
    • Business Support
    • Branding
  • Manual
    • General
      • Unity Compatibility
      • Changelog
        • Development Road Map
        • Major Version Update Solutions
      • Development
      • Performance
        • Benchmark Setup
        • Fish-Networking Vs Mirror
      • Terminology
        • Miscellaneous
        • Communicating
        • Server, Client, Host
      • Transports
      • Add-ons
        • Edgegap and other Hosting
        • Fish-Network-Discovery
      • Feature Comparison
      • Upgrading To Fish-Networking
    • Guides
      • Frequently Asked Questions (FAQ)
      • Creating Bug Reports
        • Report Example
      • Technical Limitations
      • Third-Party
      • Getting Started
        • Commonly Used Guides
        • Ownership - Moving Soon
        • Step-by-Step
          • Getting Connected
          • Preparing Your Player
      • Components
        • Managers
          • NetworkManager
          • TimeManager
          • PredictionManager
          • ServerManager
          • ClientManager
          • SceneManager
          • TransportManager
            • IntermediateLayer
          • StatisticsManager
          • ObserverManager
            • HashGrid
          • RollbackManager (Pro Feature)
        • Transports
          • FishyWebRTC
          • Bayou
          • FishyEOS (Epic Online Services)
          • FishyFacepunch (Steam)
          • FishyRealtime
          • FishySteamworks (Steam)
          • FishyUnityTransport
          • Multipass
          • Tugboat
          • Yak (Pro Feature)
        • Prediction
          • Network Collider
            • NetworkCollision
            • NetworkCollision2D
            • NetworkTrigger
            • NetworkTrigger2D
          • OfflineRigidbody
          • PredictedOwner
          • PredictedSpawn
        • Utilities
          • Tick Smoothers
            • NetworkTickSmoother
            • OfflineTickSmoother
          • MonoTickSmoother [Obsolete]
          • DetachableNetworkTickSmoother [Obsolete]
          • BandwidthDisplay
          • DefaultScene
          • PingDisplay
        • Authenticator
        • ColliderRollback
        • NetworkAnimator
        • NetworkBehaviour
        • NetworkTransform
        • NetworkObject
        • NetworkObserver
      • InstanceFinder
      • Ownership
        • Using Ownership To Read Values
      • Spawning and Despawning
        • Predicted Spawning
        • Nested NetworkObjects
        • Object Pooling
      • Components
      • NetworkBehaviour
      • NetworkObjects
      • Attributes, Quality of Life
      • Remote Procedure Calls
        • Broadcast
      • SyncTypes
        • Customizing Behavior
        • SyncVar
        • SyncList
        • SyncHashSet
        • SyncDictionary
        • SyncTimer
        • SyncStopwatch
        • Custom SyncType
      • Observers
        • Modifying Conditions
        • Custom Conditions
      • Automatic Serializers
      • Custom Serializers
        • Interface Serializers
        • Inheritance Serializers
      • Addressables
      • Scene Management
        • Scene Events
        • Scene Data
          • SceneLookupData
          • SceneLoadData
          • SceneUnloadData
        • Loading Scenes
        • Unloading Scenes
        • Scene Stacking
        • Scene Caching
        • Scene Visibility
        • Persisting NetworkObjects
        • Custom Scene Processors
          • Addressables
      • Transports
        • Multipass
      • Prediction
        • What Is Client-Side Prediction
        • Configuring PredictionManager
        • Configuring TimeManager
        • Configuring NetworkObject
        • Offline Rigidbodies
        • Interpolations
        • Creating Code
          • Controlling An Object
          • Non-Controlled Object
          • Understanding ReplicateState
            • Using States In Code
            • Predicting States In Code
          • Advanced Controls
        • Custom Comparers
        • PredictionRigidbody
        • Using NetworkColliders
      • Lag Compensation
        • States
        • Raycast
        • Projectiles
    • Server Hosting
      • Edgegap - Official Partner
        • Getting Started with Edgegap
      • Hathora
        • Getting Started with Hathora
      • Amazon Web Services (AWS)
        • Getting Started with AWS
    • API
Powered by GitBook
On this page
  • Client
  • Server
  • NonSerialized
  1. Manual
  2. Guides

Attributes, Quality of Life

There are a variety of attributes which add functionality to speed up development time.

Client

Placing a Client attribute above a method ensures that the method cannot be called unless the local client is active. There are are additional properties which may be added to the attribute for additional functionality.

 /* The server does not need to play VFX; only
 * play VFX if the client is active.
 * 
 * If this method were called with no client active
 * a warning through be printed. You can change the logging type
 * using the Logging property. 
 * 
 * It's also possible to allow only the owner of the
 * object to call the method by setting RequireOwnership
 * to true; this value is false by default. */
 [Client(Logging = LoggingType.Off, RequireOwnership = true)]
 private void PlayVFX() { }

Server

The Server attribute provides similar features of the Client varient, except will not allow the method to run if the server is not active.

/* The server would validate hit results
 * from a client.
 * 
 * Like the Client attribute a warning will be
 * thrown if this is called while the serveris not active.
 * The warning can be changed or disabled by adjusting
 * the Logging property. */
[Server(Logging = LoggingType.Off)]
private void ValidateHit() { }

NonSerialized

This attribute is part of the System namespace, and may be used to prevent a field from being serialized over the network when using your own types. It's important to remember that placing NonSerialized over a field will also prevent it from showing in the inspector, nor working for other serializers such as JsonUtility.

public class PlayerStats
{
    public float Health;
    public float MoveSpeed;
    /* In this example ControllerIndex is only used
     * for local multiplayer. This data does not need to be sent
     * over the network so it's been marked with NonSerialized. */
    [System.NonSerialized]
    public int ControllerIndex;
}
PreviousNetworkObjectsNextRemote Procedure Calls

Last updated 2 years ago