PurrNet
  • 🐈Introduction
    • ‼️Unique to PurrNet
    • 💲Pricing
    • 💻Compatibility
    • 📚Addon library
    • 🗺️Roadmap
    • 🏎️Performance
      • RPC Benchmarks
      • Network Transform benchmarks
    • 🥰Support PurrNet
  • 📚Guides
    • Installation/Setup
    • Getting Started
    • Converting to PurrNet
      • Converting from Mirror
      • Converting from FishNet
    • Lobby System
    • Networking custom classes, structs & types
    • Chat system with broadcasts
    • Easy Multiplayer Physics (input Sync)
  • 🎮Full game guides
    • 🔫First Person Shooter
    • 🪓Survival Game
  • 🖥️Systems and modules
    • Network Manager
      • Network Rules
      • Network Prefabs
      • Network Visibility
        • Distance condition
      • Transports
        • Composite Transport
        • UDP Transport
        • Web Transport
        • Local Transport
        • Steam Transport
        • Purr Transport
      • Authentication
    • PlayerID (Client connection)
    • Network Identity
      • NetworkBehaviour
      • Ownership
      • Sync Types
        • SyncVar
        • SyncList
        • SyncArray
        • SyncQueue
        • SyncDictionary
        • SyncEvent
        • SyncHashset
        • SyncTimer
      • Don't destroy on load
    • Network Modules
    • Collider Rollback
    • Client Side Prediction
      • Overview
      • Predicted Identities
      • Predicted Hierarchy
      • Best Practices
      • Input Handling
      • State Handling
    • Plug n' play components
      • Network Transform
      • Network Animator
      • Network Reflection (Auto Sync)
      • State Machine (Auto Networked)
    • Spawning & Despawning
    • Remote Procedure Call (RPC)
      • Generic RPC
      • Static RPC
      • Awaitable RPC
      • Direct Local Execution of RPCs
    • Instance Handler
    • Scene Management
    • Broadcast
  • 🤓Terminology
    • Early Access
    • Channels
    • Client Auth/Everyone (Unsafe)
    • Host
    • Server Auth (Safe)
  • 💡Integrations
    • Dissonance
    • Cozy Weather
Powered by GitBook
On this page
  1. Systems and modules
  2. Remote Procedure Call (RPC)

Generic RPC

Generic RPC's will allow you to easily send any data type over the network! You can even send multiple generics

PreviousRemote Procedure Call (RPC)NextStatic RPC

Last updated 5 months ago

Generics in C# are awesome for creating modular and scalable systems, and we didn't want PurrNet holding you back.

This works with all RPC types such as: ServerRpc, ObserversRpC, TargetRPC. It also works with and RPC's!

Below is a super simple example usage of generics with RPC's. It's as easy as that!

private void SendFirst()
{
    TestRpc("Purrfect!", true);
}

private void SendSecond()
{
    TestRpc(69, 4.20f);
}

[ServerRpc]
private void TestRpc<T, P>(T myData1, P myData2)
{
    Debug.Log($"Received {myData1} with type of: {myData1.GetType()}");
    Debug.Log($"Received {myData2} with type of: {myData2.GetType()}");
}
🖥️
static
awaitable